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]
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]
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]
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')]