summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authormelissawm <melissawm.github@gmail.com>2022-01-11 09:05:03 -0300
committermelissawm <melissawm.github@gmail.com>2022-01-11 09:31:02 -0300
commit9cdc23720a594384125ffbf6e1ef381a3b8310bc (patch)
tree238b039073f5a049bb2c1c591291de0811654427 /numpy
parent18aa14c0aa699506bea357f46a18cbdfabc3d951 (diff)
downloadnumpy-9cdc23720a594384125ffbf6e1ef381a3b8310bc.tar.gz
BUG, DOC: Fixes SciPy docs build warnings
The new f2py symbolic parser writes ternary expressions with spaces surrounding the colon operator, which causes the generated docstrings to be incorrectly parsed. Removing the spaces solves the issue.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/f2py/symbolic.py2
-rw-r--r--numpy/f2py/tests/test_symbolic.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/numpy/f2py/symbolic.py b/numpy/f2py/symbolic.py
index 1b7b35458..c2ab0f140 100644
--- a/numpy/f2py/symbolic.py
+++ b/numpy/f2py/symbolic.py
@@ -381,7 +381,7 @@ class Expr:
language=language)
for a in self.data]
if language is Language.C:
- r = f'({cond} ? {expr1} : {expr2})'
+ r = f'({cond}?{expr1}:{expr2})'
elif language is Language.Python:
r = f'({expr1} if {cond} else {expr2})'
elif language is Language.Fortran:
diff --git a/numpy/f2py/tests/test_symbolic.py b/numpy/f2py/tests/test_symbolic.py
index e8dec72f0..845278311 100644
--- a/numpy/f2py/tests/test_symbolic.py
+++ b/numpy/f2py/tests/test_symbolic.py
@@ -201,7 +201,7 @@ class TestSymbolic(util.F2PyTest):
assert (x + (x - y) / (x + y) +
n).tostring(language=language) == "123 + x + (x - y) / (x + y)"
- assert as_ternary(x, y, z).tostring(language=language) == "(x ? y : z)"
+ assert as_ternary(x, y, z).tostring(language=language) == "(x?y:z)"
assert as_eq(x, y).tostring(language=language) == "x == y"
assert as_ne(x, y).tostring(language=language) == "x != y"
assert as_lt(x, y).tostring(language=language) == "x < y"