def test_SymmetricDifference(): assert (SymmetricDifference(FiniteSet(0, 1, 2, 3, 4, 5), FiniteSet(2, 4, 6, 8, 10)) == FiniteSet( 0, 1, 3, 5, 6, 8, 10)) assert (SymmetricDifference(FiniteSet(2, 3, 4), FiniteSet(2, 3, 4, 5)) == FiniteSet(5)) assert FiniteSet(2).symmetric_difference(FiniteSet(2, 5)) == FiniteSet(5) assert (FiniteSet(1, 2, 3, 4, 5) ^ FiniteSet(1, 2, 5, 6) == FiniteSet( 3, 4, 6)) assert (Set(Integer(1), Integer(2), Integer(3)) ^ Set(Integer(2), Integer(3), Integer(4)) == Union( Set(Integer(1), Integer(2), Integer(3)) - Set(Integer(2), Integer(3), Integer(4)), Set(Integer(2), Integer(3), Integer(4)) - Set(Integer(1), Integer(2), Integer(3)))) assert (Interval(0, 4) ^ Interval(2, 5) == Union( Interval(0, 4) - Interval(2, 5), Interval(2, 5) - Interval(0, 4))) class TestSet(Set): def _symmetric_difference(self, other): return t1, t2 = TestSet(1), TestSet(2) assert t1.symmetric_difference(t2) == SymmetricDifference(t1, t2, evaluate=False)
def test_SymmetricDifference(): assert (SymmetricDifference(FiniteSet(0, 1, 2, 3, 4, 5), FiniteSet(2, 4, 6, 8, 10)) == FiniteSet( 0, 1, 3, 5, 6, 8, 10)) assert (SymmetricDifference(FiniteSet(2, 3, 4), FiniteSet(2, 3, 4, 5)) == FiniteSet(5)) assert (FiniteSet(1, 2, 3, 4, 5) ^ FiniteSet(1, 2, 5, 6) == FiniteSet( 3, 4, 6)) assert (Set(1, 2, 3) ^ Set(2, 3, 4) == Union( Set(1, 2, 3) - Set(2, 3, 4), Set(2, 3, 4) - Set(1, 2, 3))) assert (Interval(0, 4) ^ Interval(2, 5) == Union( Interval(0, 4) - Interval(2, 5), Interval(2, 5) - Interval(0, 4)))
def test_SymmetricDifference(): assert str(SymmetricDifference(Interval(2, 3), Interval(3, 4), evaluate=False)) == \ 'SymmetricDifference([2, 3], [3, 4])'