Skip to content

Commit

Permalink
Add some tests towards #79.
Browse files Browse the repository at this point in the history
  • Loading branch information
nsbgn committed Aug 12, 2022
1 parent 4aa5325 commit 0642489
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,29 @@ def test_concretization(self):
self.assertEqual(F(F(_)).concretize(replace=Top), F(F(Top)))
self.assertEqual(G.concretize(replace=Top), F(Top))

@unittest.skip("see issue #79")
def test_intersection_type_order_is_irrelevant(self):
A, B, C = (TypeOperator() for _ in range(3))
self.assertMatch(A & B & C, C & B & A, subtype=False)

@unittest.skip("see issue #79")
def test_intersection_type_subtype(self):
A, B, C = (TypeOperator() for _ in range(3))
F = TypeOperator(params=1)
self.assertMatch(A & B & C, B, subtype=True)
self.assertMatch(A & B & C, A & B, subtype=True)
self.assertMatch(A & B & C, A & C, subtype=True)
self.assertMatch(F(A & B & C), F(A), subtype=True)
self.assertNotMatch(A, A & B, subtype=True)
self.assertNotMatch(F(A), F(A & B), subtype=True)
self.assertNotMatch(F(A) & F(B), F(A & B), subtype=True)

@unittest.skip("see issue #79")
def test_empty_intersection(self):
A, B, C = (TypeOperator() for _ in range(3))
F = TypeOperator(params=1)
G = TypeOperator(params=1)
self.assertMatch(F(A) & G(A), Bottom)

if __name__ == '__main__':
unittest.main()

0 comments on commit 0642489

Please sign in to comment.