Beispiel #1
0
 def test_with_letters(self):
     input_ = [
         's', 'i', 'm', 'i', 't', 'l', 'i', 's', 'i', 'm', 'i', 't', 'l',
         'i', 'x', 'y', 'z'
     ]
     output = ('s', 'i', 'm', 'i', 't', 'l', 'i', 's', 'i', 'm', 'i', 't',
               'l', 'i')
     self.assertEqual(s.reps(input_), output)
Beispiel #2
0
 def test_fullone(self):
     self.assertEqual((1, 2, 3, 3, 2, 1),
                      s.reps([1,2,3,3,2,1]))
Beispiel #3
0
 def test_full(self):
     self.assertEqual((1, 1, 1, 1), s.reps((1, 1, 1, 1)))
Beispiel #4
0
 def test_with_int(self):
     input_ = 1, 2, 1, 3, 1, 4, 1, 5
     output = 1, 1, 1, 1
     self.assertEqual(s.reps(input_), output)
Beispiel #5
0
 def test_without_reps(self):
     self.assertEqual((), s.reps((1, 2, 3)))
Beispiel #6
0
 def test_with_more_repetition(self):
     self.assertEqual((1, 2, 2, 1), s.reps((1, 2, 2, 3, 1, 7)))
Beispiel #7
0
 def test_with_letters(self):
     input_ = ['s', 'i', 'm', 'i', 't', 'l', 'i',
               's', 'i', 'm', 'i', 't', 'l', 'i', 'x', 'y', 'z']
     output = ('s', 'i', 'm', 'i', 't', 'l', 'i',
               's', 'i', 'm', 'i', 't', 'l', 'i')
     self.assertEqual(s.reps(input_), output)
Beispiel #8
0
 def test_ones(self):
     self.assertEqual((1, 1, 1, 1, 1, 1, 1, 1), solution.reps((1, 1, 1, 1, 1, 1, 1, 1)))
     self.assertEqual((1, 1, 1, 1, 1, 1, 1, 1), solution.reps([1, 1, 1, 1, 1, 1, 1, 1]))
Beispiel #9
0
 def test_bool(self):
     input_ = [False, True, False, False]
     output = (False, False, False)
     self.assertEqual(solution.reps(input_), output)
Beispiel #10
0
 def test_empty(self):
     input_ = [1, 2, 3, 4, 5]
     self.assertEqual(s.reps(input_), ())
Beispiel #11
0
 def test_letters(self):
     input_ = ['f', 's', 's', 'w', 'b', 'l', 'f',
               'a', 'z', 'z', 'i', 't', 'm', 'd', 'x', 's', 't']
     output = ('f', 's', 's', 'f',
               'z', 'z', 't', 's', 't')
     self.assertEqual(solution.reps(input_), output)
Beispiel #12
0
 def test_example_case(self):
     self.assertEqual(
         (1, 5, 2, 2, 1, 2, 5, 1),
         solution.reps([1, 5, 2, 6, 90, 2, 4, 11, 1, 9, 0, 2, 5, 3, 1])
     )
Beispiel #13
0
 def test_non_empty(self):
     self.assertEqual((1, 1, 2, 2, 3, 3), solution.reps([1, 1, 2, 2, 3, 3]))
     self.assertEqual((6, 5, 6, 5), solution.reps([6, 1, 5, 6, 2, 3, 4, 5]))
     self.assertEqual((1, 2, 7, 1, 2, 7, 1, 9, 2, 9), solution.reps((1, 2, 7, 1, 2, 7, 1, 9, 2, 9)))
Beispiel #14
0
 def test_some(self):
     self.assertEqual((4, 4, 4, 7, 7), s.reps([4,5,4,1,4,7,76,54,3,7]))
Beispiel #15
0
 def test_with_bool(self):
     input_ = True, False, True, True
     output = True, True, True
     self.assertEqual(s.reps(input_), output)
Beispiel #16
0
 def test_with_reps_only(self):
     self.assertEqual((1, 2, 1, 2, 1, 2), s.reps((1, 2, 1, 2, 1, 2)))
Beispiel #17
0
 def test_with_int(self):
     input_ = 1, 2, 1, 3, 1, 4, 1, 5
     output = 1, 1, 1, 1
     self.assertEqual(s.reps(input_), output)
Beispiel #18
0
 def test_with_more_repetition(self):
     self.assertEqual((1, 2, 2, 1), s.reps((1, 2, 2, 3, 1, 7)))
Beispiel #19
0
 def test_with_dict(self):
     input_ = {}, {'a': 1}, {}, {'a': 2}, {'a': 1}, {}
     output = {}, {'a': 1}, {}, {'a': 1}, {}
     self.assertEqual(s.reps(input_), output)
Beispiel #20
0
 def test_with_one_repetition(self):
     self.assertEqual((1, 1), s.reps((1, 2, 3, 1, 5)))
Beispiel #21
0
 def test_full(self):
     self.assertEqual((1, 1, 1, 1), solution.reps((1, 1, 1, 1)))
Beispiel #22
0
 def test_empty(self):
     input_ = [1, 2, 3, 4, 5]
     self.assertEqual(s.reps(input_), ())
Beispiel #23
0
 def test_empty(self):
     self.assertEqual((), solution.reps((1, 2, 3, 4, 5, 6)))
Beispiel #24
0
 def test_with_bool(self):
     input_ = True, False, True, True
     output = True, True, True
     self.assertEqual(s.reps(input_), output)
Beispiel #25
0
 def test_fullone(self):
     self.assertEqual((1, 2, 3, 3, 2, 1), solution.reps([1, 2, 3, 3, 2, 1]))
Beispiel #26
0
 def test_with_dict(self):
     input_ = {}, {'a': 1}, {}, {'a': 2}, {'a': 1}, {}
     output = {}, {'a': 1}, {}, {'a': 1}, {}
     self.assertEqual(s.reps(input_), output)
Beispiel #27
0
 def test_empty_gain(self):
     self.assertEqual((), solution.reps([]))
Beispiel #28
0
 def test_empty(self):
     self.assertEqual((), s.reps((1,2,3,4,5,6)))
Beispiel #29
0
 def test_some(self):
     self.assertEqual((4, 4, 4, 7, 7),
                      solution.reps([4, 5, 4, 1, 4, 7, 76, 54, 3, 7]))
Beispiel #30
0
 def test_empty_gain(self):
     self.assertEqual((), s.reps([]))
Beispiel #31
0
 def test_without_reps(self):
     self.assertEqual((), s.reps((1, 2, 3)))
Beispiel #32
0
 def test_with_uniques_only(self):
     self.assertEqual(tuple(), s.reps([1, 2, 3, 4]))
Beispiel #33
0
 def test_with_one_repetition(self):
     self.assertEqual((1, 1), s.reps((1, 2, 3, 1, 5)))
Beispiel #34
0
 def test_example_case(self):
     self.assertEqual(
         (1, 4, 2, 2, 4, 1, 2, 1),
         s.reps([1, 4, 2, 6, 7, 2, 4, 11, 1, 9, 0, 2, 5, 3, 1])
     )
Beispiel #35
0
 def test_empty(self):
     self.assertEqual((), solution.reps((1, 2, 7, 43, 52, 61)) )
     self.assertEqual((), solution.reps(()) )
     self.assertEqual((), solution.reps([]) )
     self.assertEqual((), solution.reps([2]) )
     self.assertEqual((), solution.reps((1,)) )