def test_startswith(self): pd = PrefixDict() keys = [''.join(combo) for combo in itertools.product('abc', repeat=3)] for key in reversed(keys): pd[key] = None subset = [k for k in keys if k.startswith('ab')] self.assertSequenceEqual(subset, list(pd.startswith('ab')))
def test_startswith_empty(self): pd = PrefixDict() pd['a'] = None self.assertSequenceEqual([], list(pd.startswith('b')))