예제 #1
0
def test_inters_conflicting():
    a = Definition(('spam', 'eggs'), ('ni', ), [(True, ), (False, )])
    b = Definition(('ham', 'spam'), (
        'nini',
        'ni',
    ), [(True, True), (False, False)])
    with pytest.raises(ValueError, match=r"\[\('spam', 'ni'\)\]"):
        a.intersection(b)
예제 #2
0
def test_inters_compatible():
    a = Definition(('spam', 'eggs'), ('ni', ), [(True, ), (False, )])
    b = Definition(('ham', 'spam'), (
        'nini',
        'ni',
    ), [(True, True), (False, True)])
    assert a.intersection(b) == Definition(['spam'], ['ni'], [(True, )])
예제 #3
0
def test_inters_ignoring():
    a = Definition(('spam', 'eggs'), ('ni', ), [(True, ), (False, )])
    b = Definition(('ham', 'spam'), (
        'nini',
        'ni',
    ), [(True, True), (False, False)])
    assert a.intersection(b, ignore_conflicts=True) == \
           Definition(['spam'], ['ni'], [(False,)])
예제 #4
0
 def test_ignoring(self):
     a = Definition(('spam', 'eggs'), ('ni',), [(True,), (False,)])
     b = Definition(('ham', 'spam'), ('nini', 'ni',), [(True, True), (False, False)])
     self.assertEqual(a.intersection(b, ignore_conflicts=True),
         Definition(['spam'], ['ni'], [(False,)]))
예제 #5
0
 def test_conflicting(self):
     a = Definition(('spam', 'eggs'), ('ni',), [(True,), (False,)])
     b = Definition(('ham', 'spam'), ('nini', 'ni',), [(True, True), (False, False)])
     with self.assertRaisesRegexp(ValueError, "\[\('spam', 'ni'\)\]"):
         a.intersection(b)
예제 #6
0
 def test_compatible(self):
     a = Definition(('spam', 'eggs'), ('ni',), [(True,), (False,)])
     b = Definition(('ham', 'spam'), ('nini', 'ni',), [(True, True), (False, True)])
     self.assertEqual(a.intersection(b),
         Definition(['spam'], ['ni'], [(True,)]))