Test failure in master (not hash randomization)

6 views
Skip to first unread message

Julien Rioux

unread,
Jul 2, 2012, 5:54:08 AM7/2/12
to sy...@googlegroups.com
Hi all,

I notice this failure in master (this is without hash randomization):

./bin/test --no-subprocess sets
===================================== test process starts ======================================
executable:         /usr/bin/python  (2.7.2-final-0)
architecture:       64-bit
cache:              yes
ground types:       python
random seed:        13242493
hash randomization: off

sympy/combinatorics/tests/test_subsets.py[1] .                                              [OK]
sympy/core/tests/test_sets.py[27] ......F....................                             [FAIL]
sympy/sets/tests/test_fancysets.py[11] ......Xf...                                          [OK]

________________________________________ xpassed tests _________________________________________
sympy/sets/tests/test_fancysets.py: test_halfcircle

________________________________________________________________________________________________
_______________________ sympy/core/tests/test_sets.py:test_intersection ________________________
  File "/home/jacobi/jrioux/git/sympy-jrioux/sympy/core/tests/test_sets.py", line 187, in test_intersection
    assert set(i) == set([2, 3])
AssertionError

 tests finished: 36 passed, 1 failed, 1 expected to fail, 1 expected to fail but passed,
in 0.75 seconds
DO *NOT* COMMIT!

It is fixed by this patch:

diff --git a/sympy/core/tests/test_sets.py b/sympy/core/tests/test_sets.py
index adaba2d..4ce6051 100644
--- a/sympy/core/tests/test_sets.py
+++ b/sympy/core/tests/test_sets.py
@@ -184,7 +184,7 @@ def test_intersection():
     # iterable
     i = Intersection(FiniteSet(1,2,3), Interval(2, 5), evaluate=False)
     assert i.is_iterable
-    assert set(i) == set([2, 3])
+    assert set(i) == set([S(2), S(3)])
 
     # challenging intervals
     x = Symbol('x', real=True)

But I am not sure if this is the proper way to fix it, as one could argue that set(Intersection(...)) should return a set that includes python types instead of sympy types.

Cheers,
Julien

Aaron Meurer

unread,
Jul 2, 2012, 1:57:49 PM7/2/12
to sy...@googlegroups.com
Yes, this is right. I thought I had pushed this fix up to my branch before it was merged, but I guess not. 

Aaron Meurer


--
You received this message because you are subscribed to the Google Groups "sympy" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sympy/-/FjUbmBJo9a8J.
To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sympy?hl=en.

Ondřej Čertík

unread,
Jul 2, 2012, 4:40:59 PM7/2/12
to sy...@googlegroups.com
You are right --- I was thinking about the same thing when I wrote it.

But ultimately, it is extremely important that all our tests pass,
so that other people can continue working. Last
time for example #1396 (https://github.com/sympy/sympy/pull/1396)
was bitten by the fact that master fails and so it
wasn't immediately clear that the tests pass.

So for many sympy contributors, it is of utter importance
to have stable, reproducible and passing tests in master, so that we
can immediately see if a PR passes or fails.

Ondrej

Aaron Meurer

unread,
Jul 2, 2012, 4:49:02 PM7/2/12
to sy...@googlegroups.com
I think it makes sense to leave them as SymPy types. set() or list()
or whatever should only convert the datatype, not the contents of the
datatype. It's infeasible anyway because they just work by using
__iter__, not to mention inconsistent (set(FiniteSet(Integer(1)))
would give set([int(1)]) but set(FiniteSet(Rational(1, 2))) would give
???).

The real issue here is that set([1, 2]) == set([S(1), S(2)]) gives
False, because of http://code.google.com/p/sympy/issues/detail?id=1973
(ironically enough, I believe the road to fixing that also involves
removing sorting from .args).

Aaron Meurer

>
> But ultimately, it is extremely important that all our tests pass,
> so that other people can continue working. Last
> time for example #1396 (https://github.com/sympy/sympy/pull/1396)
> was bitten by the fact that master fails and so it
> wasn't immediately clear that the tests pass.
>
> So for many sympy contributors, it is of utter importance
> to have stable, reproducible and passing tests in master, so that we
> can immediately see if a PR passes or fails.
>
> Ondrej
>
> --
> You received this message because you are subscribed to the Google Groups "sympy" group.
Reply all
Reply to author
Forward
0 new messages