Exemplo n.º 1
0
 def test_duplicate_numbers(self):
     """Tests if duplicated numbers are properly handled."""
     to_sort = ["20", "20", "1", "1", "cat", "bi?rd", "12", "for#^get"]
     correctly_sorted = [
         "1", "1", "12", "20", "bird", "cat", "20", "forget"
     ]
     self.assertEqual(process_list(to_sort, S_M), correctly_sorted)
Exemplo n.º 2
0
 def test_mixed_list_alphanum(self):
     """Checks that a list containing ints & strings is handled correctly."""
     to_sort = ["dog", "20", "bird", "cat", "431", "12", "ice", "9"]
     correctly_sorted = [
         "bird", "9", "cat", "dog", "12", "20", "ice", "431"
     ]
     self.assertEqual(process_list(to_sort, S_M), correctly_sorted)
Exemplo n.º 3
0
 def test_duplicate_words(self):
     """Tests if duplicated words are properly handled."""
     to_sort = ["20", "cat", "bi?rd", "12", "do@g", "dog", "cat"]
     correctly_sorted = ["12", "bird", "cat", "20", "cat", "dog", "dog"]
     self.assertEqual(process_list(to_sort, S_M), correctly_sorted)
Exemplo n.º 4
0
 def test_mixed_all(self):
     """Checks correct handling of string + int + non-alphanumeric chars."""
     to_sort = ["20", "cat", "bi?rd", "12", "do@g"]
     correctly_sorted = ["12", "bird", "cat", "20", "dog"]
     self.assertEqual(process_list(to_sort, S_M), correctly_sorted)
Exemplo n.º 5
0
 def test_non_alphanum_only(self):
     """Checks for correct handling of only non-alphanumeric characters."""
     to_sort = ["@!#$", "^^^^", "?!@?@#*@#$"]
     correctly_sorted = []
     self.assertEqual(process_list(to_sort, S_M), correctly_sorted)
Exemplo n.º 6
0
 def test_list_no_str(self):
     """Checks that a list with no strings is handled correctly."""
     to_sort = ["123", "555", "212", "313", "111", "99"]
     correctly_sorted = ["99", "111", "123", "212", "313", "555"]
     self.assertEqual(process_list(to_sort, S_M), correctly_sorted)
Exemplo n.º 7
0
 def test_list_no_int(self):
     """Checks that a list with no integers is handled correctly."""
     to_sort = ["abc", "dog", "cat", "frog", "zzz", "telephone"]
     correctly_sorted = sorted(to_sort)
     self.assertEqual(process_list(to_sort, S_M), correctly_sorted)
Exemplo n.º 8
0
 def test_empty_list(self):
     """Checks that empty lists are handled correctly."""
     to_sort = []
     correctly_sorted = []
     self.assertEqual(process_list(to_sort, S_M), correctly_sorted)