예제 #1
0
 def test_simplify_simple(self):
     # type: () -> None
     for first, second in ((CT('str'), CT('Text')),
                           (CT('bool'), CT('int')),
                           (CT('int'), CT('float'))):
         assert remove_redundant_items([first, second]) == [second]
         assert remove_redundant_items([second, first]) == [second]
예제 #2
0
 def test_cannot_simplify(self):
     # type: () -> None
     for first, second in ((CT('str'), CT('int')), (CT('List', [CT('int')]),
                                                    CT('List',
                                                       [CT('str')])),
                           (CT('List'), CT('Set', [CT('int')]))):
         assert remove_redundant_items([first, second]) == [first, second]
         assert remove_redundant_items([second, first]) == [second, first]
예제 #3
0
 def test_simplify_generics(self):
     # type: () -> None
     for first, second in ((CT('List'), CT('List', [CT('Text')])),
                           (CT('Set'), CT('Set', [CT('Text')])),
                           (CT('Dict'), CT('Dict',
                                           [CT('str'), CT('int')]))):
         assert remove_redundant_items([first, second]) == [second]
예제 #4
0
 def test_simplify_multiple(self):
     # type: () -> None
     assert remove_redundant_items(
         [CT('Text'), CT('str'),
          CT('bool'), CT('int'),
          CT('X')]) == [CT('Text'), CT('int'),
                        CT('X')]