8000 Merge pull request #5149 from charris/fix-ma-docs-for-OO-option · numpy/numpy@cd0b8e7 · GitHub
[go: up one dir, main page]

Skip to content

Commit cd0b8e7

Browse files
committed
Merge pull request #5149 from charris/fix-ma-docs-for-OO-option
BUG: Make numpy import when run with Python flag '-OO
2 parents 58350f4 + 43ca904 commit cd0b8e7

File tree

5 files changed

+18
-6
lines changed

5 files changed

+18
-6
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ matrix:
1313
- python: 3.2
1414
env: USE_DEBUG=1
1515
- python: 2.7
16-
env: NPY_SEPARATE_COMPILATION=0
16+
env: NPY_SEPARATE_COMPILATION=0 PYTHON_OO=1
1717
- python: 3.4
1818
env: NPY_RELAXED_STRIDES_CHECKING=0
1919
- python: 2.7

numpy/lib/tests/test_function_base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
from __future__ import division, absolute_import, print_function
22

33
import warnings
4+
import sys
45

56
import numpy as np
67
from numpy.testing import (
78
run_module_suite, TestCase, assert_, assert_equal, assert_array_equal,
89
assert_almost_equal, assert_array_almost_equal, assert_raises,
9-
assert_allclose, assert_array_max_ulp, assert_warns, assert_raises_regex
10+
assert_allclose, assert_array_max_ulp, assert_warns,
11+
assert_raises_regex, dec
1012
)
1113
from numpy.random import rand
1214
from numpy.lib import *
@@ -2119,6 +2121,8 @@ def test_string_arg(self):
21192121

21202122

21212123
class TestAdd_newdoc(TestCase):
2124+
2125+
@dec.skipif(sys.flags.optimize == 2)
21222126
def test_add_doc(self):
21232127
# test np.add_newdoc
21242128
tgt = "Current flat index into the array."

numpy/lib/tests/test_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44
from numpy.core import arange
55
from numpy.testing import (
6-
run_module_suite, assert_, assert_equal
6+
run_module_suite, assert_, assert_equal, dec
77
)
88
from numpy.lib import deprecate
99
import numpy.lib.utils as utils
@@ -14,6 +14,7 @@
1414
from StringIO import StringIO
1515

1616

17+
@dec.skipif(sys.flags.optimize == 2)
1718
def test_lookfor():
1819
out = StringIO()
1920
utils.lookfor('eigenvalue', module='numpy', output=out,

numpy/ma/extras.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,10 @@ def apply_over_axes(func, a, axes):
434434
raise ValueError("function is not returning "
435435
"an array of the correct shape")
436436
return val
437-
apply_over_axes.__doc__ = np.apply_over_axes.__doc__[
438-
:np.apply_over_axes.__doc__.find('Notes')].rstrip() + \
437+
438+
if apply_over_axes.__doc__ is not None:
439+
apply_over_axes.__doc__ = np.apply_over_axes.__doc__[
440+
:np.apply_over_axes.__doc__.find('Notes')].rstrip() + \
439441
"""
440442
441443
Examples
@@ -462,7 +464,7 @@ def apply_over_axes(func, a, axes):
462464
[[[46]
463465
[--]
464466
[124]]]
465-
"""
467+
"""
466468

467469

468470
def average(a, axis=None, weights=None, returned=False):

tools/travis-test.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ run_test()
8888
if [ -n "$USE_DEBUG" ]; then
8989
export PYTHONPATH=$PWD
9090
fi
91+
9192
# We change directories to make sure that python won't find the copy
9293
# of numpy in the source directory.
9394
mkdir -p empty
@@ -109,6 +110,10 @@ if [ -n "$USE_DEBUG" ]; then
109110
PYTHON=python3-dbg
110111
fi
111112

113+
if [ -n "$PYTHON_OO" ]; then
114+
PYTHON="$PYTHON -OO"
115+
fi
116+
112117
export PYTHON
113118
export PIP
114119
if [ -n "$USE_WHEEL" ] && [ $# -eq 0 ]; then

0 commit comments

Comments
 (0)
0