def test_union_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.union(b)
def test_union_ignoring():
    a = Definition(('spam', 'eggs'), ('ni', ), [(True, ), (False, )])
    b = Definition(('ham', 'spam'), (
        'nini',
        'ni',
    ), [(True, True), (False, False)])
    assert a.union(b, ignore_conflicts=True) == \
        Definition(('spam', 'eggs', 'ham'), ('ni', 'nini'),
                   [(True, False), (False, False), (True, True)])
def test_union_compatible():
    a = Definition(('spam', 'eggs'), ('ni', ), [(True, ), (False, )])
    b = Definition(('ham', 'spam'), (
        'nini',
        'ni',
    ), [(True, True), (False, True)])
    assert a.union(b) == \
           Definition(('spam', 'eggs', 'ham'), ('ni', 'nini'),
                      [(True, False), (False, False), (True, True)])
Beispiel #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.union(b, ignore_conflicts=True),
         Definition(('spam', 'eggs', 'ham'), ('ni', 'nini'),
             [(True, False), (False, False), (True, True)]))
Beispiel #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.union(b)
Beispiel #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.union(b),
         Definition(('spam', 'eggs', 'ham'), ('ni', 'nini'),
             [(True, False), (False, False), (True, True)]))