Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trac #32185: Failing weak order assertion on random symbolic expression
{{{ File "src/sage/symbolic/random_tests.py", line 430, in sage.symbolic.random_tests.test_symbolic_expression_order Failed example: test_symbolic_expression_order(10000) # long time Exception raised: Traceback (most recent call last): File "/srv/public/kliem/sage/local/lib/python3.7/site- packages/sage/doctest/forker.py", line 718, in _run self.compile_and_execute(example, compiler, test.globs) File "/srv/public/kliem/sage/local/lib/python3.7/site- packages/sage/doctest/forker.py", line 1137, in compile_and_execute exec(compiled, globs) File "<doctest sage.symbolic.random_tests.test_symbolic_expression_order[2]>", line 1, in <module> test_symbolic_expression_order(Integer(10000)) # long time File "/srv/public/kliem/sage/local/lib/python3.7/site- packages/sage/symbolic/random_tests.py", line 456, in test_symbolic_expression_order assert_strict_weak_order(a, b, c, mixed_order) File "/srv/public/kliem/sage/local/lib/python3.7/site- packages/sage/symbolic/random_tests.py", line 387, in assert_strict_weak_order cmp_M[i, j] = (cmp_func(x[i], x[j]) == 1) # or -1, doesn't matter File "sage/symbolic/comparison.pyx", line 228, in sage.symbolic.comparison.mixed_order (build/cythonized/sage/symbolic/comparison.cpp:4349) cpdef int mixed_order(lhs, rhs) except -2: File "sage/symbolic/comparison.pyx", line 268, in sage.symbolic.comparison.mixed_order (build/cythonized/sage/symbolic/comparison.cpp:4126) less_than = _mixed_key(lhs) < _mixed_key(rhs) File "sage/symbolic/comparison.pyx", line 355, in sage.symbolic.comparison._mixed_key.__lt__ (build/cythonized/sage/symbolic/comparison.cpp:5238) return det_ex < 0 TypeError: '<' not supported between instances of 'Pi' and 'int' ********************************************************************** 1 item had failures: 2 of 4 in sage.symbolic.random_tests.test_symbolic_expression_order [49 tests, 2 failures, 3.59 s] }}} The underlying problem is the following: {{{ sage: pi = sage.symbolic.constants.Pi() sage: pi < 0 ------------------------------------------------------------------------ --- TypeError Traceback (most recent call last) <ipython-input-7-f23f08971c70> in <module> ----> 1 pi < Integer(0) /srv/public/kliem/sage/local/lib/python3.7/site- packages/sage/rings/integer.pyx in sage.rings.integer.Integer.__richcmp__ (build/cythonized/sage/rings/integer.c:7888)() 947 c = mpz_cmp_d((<Integer>left).value, d) 948 else: --> 949 return coercion_model.richcmp(left, right, op) 950 951 return rich_to_bool_sgn(op, c) /srv/public/kliem/sage/local/lib/python3.7/site- packages/sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel.richcmp (build/cythonized/sage/structure/coerce.c:20854)() 2006 raise bin_op_exception('<=', x, y) 2007 elif op == Py_GT: -> 2008 raise bin_op_exception('>', x, y) 2009 else: 2010 raise bin_op_exception('>=', x, y) TypeError: unsupported operand parent(s) for >: 'Integer Ring' and '<class 'sage.symbolic.constants.Pi'>' }}} URL: https://trac.sagemath.org/32185 Reported by: gh-kliem Ticket author(s): Michael Orlitzky Reviewer(s): Travis Scrimshaw
- Loading branch information