Exemplo n.º 1
0
 def test_is_unique(self):
     tests = ['', 'a', 'abcdef', 'aa', 'abcda']
     expected = [True, True, True, False, False]
     fns = [(lambda x: is_unique(x)), (lambda x: is_unique_no_ds(x))]
     for fn in fns:
         for i in range(len(tests)):
             actual = fn(tests[i])
             self.assertEqual(actual, expected[i],
                              'case {} for fn {} failed'.format(i, fn))
 def test_worst_case(self):
     self.assertEqual(subject.is_unique('abcdefghijklmnopp'), False)
 def test_repeated(self):
     self.assertEqual(subject.is_unique('ababababa'), False)
 def test_simple(self):
     self.assertEqual(subject.is_unique('abcdef'), True)
 def test_trivial(self):
     self.assertEqual(subject.is_unique(''), True)