trackler 2.0.8.27 → 2.0.8.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/common/exercises/simple-cipher/description.md +1 -1
  3. data/common/exercises/triangle/description.md +12 -23
  4. data/lib/trackler/version.rb +1 -1
  5. data/tracks/kotlin/config.json +5 -0
  6. data/tracks/kotlin/exercises/bank-account/build.gradle +32 -0
  7. data/tracks/kotlin/exercises/bank-account/src/example/kotlin/BankAccount.kt +27 -0
  8. data/tracks/kotlin/exercises/bank-account/src/main/kotlin/.keep +0 -0
  9. data/tracks/kotlin/exercises/bank-account/src/test/kotlin/BankAccountTest.kt +73 -0
  10. data/tracks/kotlin/exercises/settings.gradle +1 -0
  11. data/tracks/python/config.json +11 -11
  12. data/tracks/python/exercises/accumulate/accumulate_test.py +16 -14
  13. data/tracks/python/exercises/acronym/acronym_test.py +8 -7
  14. data/tracks/python/exercises/allergies/allergies_test.py +5 -6
  15. data/tracks/python/exercises/atbash-cipher/atbash_cipher_test.py +16 -22
  16. data/tracks/python/exercises/binary-search/binary_search_test.py +12 -10
  17. data/tracks/python/exercises/binary/binary_test.py +7 -8
  18. data/tracks/python/exercises/circular-buffer/circular_buffer_test.py +16 -17
  19. data/tracks/python/exercises/clock/clock_test.py +35 -35
  20. data/tracks/python/exercises/crypto-square/crypto_square_test.py +5 -6
  21. data/tracks/python/exercises/diamond/diamond_test.py +3 -4
  22. data/tracks/python/exercises/etl/etl_test.py +4 -4
  23. data/tracks/python/exercises/gigasecond/gigasecond_test.py +11 -19
  24. data/tracks/python/exercises/grade-school/grade_school_test.py +17 -19
  25. data/tracks/python/exercises/grains/grains_test.py +14 -14
  26. data/tracks/python/exercises/grep/grep_test.py +51 -64
  27. data/tracks/python/exercises/hamming/hamming_test.py +13 -13
  28. data/tracks/python/exercises/hello-world/hello_world_test.py +1 -2
  29. data/tracks/python/exercises/hexadecimal/hexadecimal_test.py +9 -10
  30. data/tracks/python/exercises/house/house_test.py +6 -6
  31. data/tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py +22 -19
  32. data/tracks/python/exercises/largest-series-product/largest_series_product_test.py +29 -28
  33. data/tracks/python/exercises/linked-list/linked_list_test.py +18 -19
  34. data/tracks/python/exercises/list-ops/list_ops_test.py +44 -39
  35. data/tracks/python/exercises/matrix/matrix_test.py +6 -6
  36. data/tracks/python/exercises/meetup/meetup_test.py +27 -27
  37. data/tracks/python/exercises/minesweeper/example.py +4 -2
  38. data/tracks/python/exercises/minesweeper/minesweeper_test.py +9 -9
  39. data/tracks/python/exercises/nucleotide-count/nucleotide_count_test.py +6 -6
  40. data/tracks/python/exercises/ocr-numbers/ocr_numbers_test.py +63 -49
  41. data/tracks/python/exercises/octal/octal_test.py +7 -7
  42. data/tracks/python/exercises/palindrome-products/palindrome_products_test.py +9 -9
  43. data/tracks/python/exercises/pascals-triangle/pascals_triangle_test.py +7 -7
  44. data/tracks/python/exercises/phone-number/phone_number_test.py +8 -8
  45. data/tracks/python/exercises/pig-latin/pig_latin_test.py +15 -15
  46. data/tracks/python/exercises/point-mutations/point_mutations_test.py +11 -11
  47. data/tracks/python/exercises/poker/poker_test.py +32 -30
  48. data/tracks/python/exercises/prime-factors/prime_factors_test.py +11 -11
  49. data/tracks/python/exercises/proverb/proverb_test.py +16 -9
  50. data/tracks/python/exercises/pythagorean-triplet/pythagorean_triplet_test.py +14 -12
  51. data/tracks/python/exercises/queen-attack/queen_attack_test.py +10 -10
  52. data/tracks/python/exercises/rail-fence-cipher/example.py +2 -1
  53. data/tracks/python/exercises/rail-fence-cipher/rail_fence_cipher_test.py +14 -13
  54. data/tracks/python/exercises/raindrops/raindrops_test.py +16 -16
  55. data/tracks/python/exercises/rectangles/rectangles_test.py +9 -9
  56. data/tracks/python/exercises/rna-transcription/rna_transcription_test.py +8 -8
  57. data/tracks/python/exercises/robot-name/robot_name_test.py +1 -1
  58. data/tracks/python/exercises/robot-simulator/robot_simulator_test.py +18 -19
  59. data/tracks/python/exercises/roman-numerals/roman_numerals_test.py +1 -1
  60. data/tracks/python/exercises/run-length-encoding/run_length_encoding_test.py +15 -16
  61. data/tracks/python/exercises/saddle-points/saddle_points_test.py +4 -4
  62. data/tracks/python/exercises/say/say_test.py +21 -23
  63. data/tracks/python/exercises/scrabble-score/scrabble_score_test.py +9 -9
  64. data/tracks/python/exercises/secret-handshake/secret_handshake_test.py +14 -13
  65. data/tracks/python/exercises/series/example.py +3 -3
  66. data/tracks/python/exercises/series/series_test.py +16 -12
  67. data/tracks/python/exercises/simple-cipher/simple_cipher_test.py +21 -19
  68. data/tracks/python/exercises/space-age/space_age_test.py +16 -16
  69. data/tracks/python/exercises/strain/strain_test.py +9 -8
  70. data/tracks/python/exercises/sublist/sublist_test.py +19 -20
  71. data/tracks/python/exercises/sum-of-multiples/example.py +1 -4
  72. data/tracks/python/exercises/sum-of-multiples/sum_of_multiples_test.py +31 -26
  73. data/tracks/python/exercises/triangle/triangle_test.py +15 -30
  74. data/tracks/python/exercises/trinary/trinary_test.py +7 -7
  75. data/tracks/python/exercises/twelve-days/twelve_days_test.py +13 -14
  76. data/tracks/python/exercises/word-count/example.py +1 -9
  77. data/tracks/python/exercises/word-count/word_count_test.py +0 -15
  78. data/tracks/python/exercises/wordy/wordy_test.py +17 -18
  79. data/tracks/python/exercises/zebra-puzzle/example.py +20 -23
  80. data/tracks/python/exercises/zebra-puzzle/zebra_puzzle_test.py +3 -3
  81. data/tracks/python/test/check-exercises.py +1 -1
  82. metadata +6 -2
@@ -13,7 +13,7 @@ class QueenAttackTest(unittest.TestCase):
13
13
  '______B_',
14
14
  '________',
15
15
  '________']
16
- self.assertEqual(ans, board((2, 3), (5, 6)))
16
+ self.assertEqual(board((2, 3), (5, 6)), ans)
17
17
 
18
18
  def test_board2(self):
19
19
  ans = ['______W_',
@@ -24,31 +24,31 @@ class QueenAttackTest(unittest.TestCase):
24
24
  '________',
25
25
  '________',
26
26
  '________']
27
- self.assertEqual(ans, board((0, 6), (1, 7)))
27
+ self.assertEqual(board((0, 6), (1, 7)), ans)
28
28
 
29
29
  def test_attack_true1(self):
30
- self.assertEqual(True, can_attack((2, 3), (5, 6)))
30
+ self.assertTrue(can_attack((2, 3), (5, 6)))
31
31
 
32
32
  def test_attack_true2(self):
33
- self.assertEqual(True, can_attack((2, 6), (5, 3)))
33
+ self.assertTrue(can_attack((2, 6), (5, 3)))
34
34
 
35
35
  def test_attack_true3(self):
36
- self.assertEqual(True, can_attack((2, 4), (2, 7)))
36
+ self.assertTrue(can_attack((2, 4), (2, 7)))
37
37
 
38
38
  def test_attack_true4(self):
39
- self.assertEqual(True, can_attack((5, 4), (2, 4)))
39
+ self.assertTrue(can_attack((5, 4), (2, 4)))
40
40
 
41
41
  def test_attack_true5(self):
42
- self.assertEqual(True, can_attack((1, 1), (6, 6)))
42
+ self.assertTrue(can_attack((1, 1), (6, 6)))
43
43
 
44
44
  def test_attack_true6(self):
45
- self.assertEqual(True, can_attack((0, 6), (1, 7)))
45
+ self.assertTrue(can_attack((0, 6), (1, 7)))
46
46
 
47
47
  def test_attack_false1(self):
48
- self.assertEqual(False, can_attack((4, 2), (0, 5)))
48
+ self.assertFalse(can_attack((4, 2), (0, 5)))
49
49
 
50
50
  def test_attack_false2(self):
51
- self.assertEqual(False, can_attack((2, 3), (4, 7)))
51
+ self.assertFalse(can_attack((2, 3), (4, 7)))
52
52
 
53
53
  # If either board or can_attack are called with an invalid board position
54
54
  # they should raise a ValueError with a meaningful error message.
@@ -14,4 +14,5 @@ def encode(msg, rails):
14
14
  def decode(msg, rails):
15
15
  fence = fence_pattern(rails, len(msg))
16
16
  fence_msg = zip(msg, sorted(fence))
17
- return ''.join(char for char, _ in sorted(fence_msg, key=lambda item: item[1][1]))
17
+ return ''.join(
18
+ char for char, _ in sorted(fence_msg, key=lambda item: item[1][1]))
@@ -4,31 +4,32 @@ from rail_fence_cipher import encode, decode
4
4
 
5
5
 
6
6
  class RailFenceTests(unittest.TestCase):
7
-
8
7
  def test_encode_with_two_rails(self):
9
- self.assertMultiLineEqual('XXXXXXXXXOOOOOOOOO',
10
- encode('XOXOXOXOXOXOXOXOXO', 2))
8
+ self.assertMultiLineEqual(
9
+ encode('XOXOXOXOXOXOXOXOXO', 2), 'XXXXXXXXXOOOOOOOOO')
11
10
 
12
11
  def test_encode_with_three_rails(self):
13
- self.assertMultiLineEqual('WECRLTEERDSOEEFEAOCAIVDEN',
14
- encode('WEAREDISCOVEREDFLEEATONCE', 3))
12
+ self.assertMultiLineEqual(
13
+ encode('WEAREDISCOVEREDFLEEATONCE', 3),
14
+ 'WECRLTEERDSOEEFEAOCAIVDEN')
15
15
 
16
16
  def test_encode_with_middle_stop(self):
17
- self.assertMultiLineEqual('ESXIEECSR', encode('EXERCISES', 4))
17
+ self.assertMultiLineEqual(encode('EXERCISES', 4), 'ESXIEECSR')
18
18
 
19
19
  def test_decode_with_three_rails(self):
20
- self.assertMultiLineEqual('THEDEVILISINTHEDETAILS',
21
- decode('TEITELHDVLSNHDTISEIIEA', 3))
20
+ self.assertMultiLineEqual(
21
+ decode('TEITELHDVLSNHDTISEIIEA', 3), 'THEDEVILISINTHEDETAILS')
22
22
 
23
23
  def test_decode_with_five_rails(self):
24
- self.assertMultiLineEqual('EXERCISMISAWESOME',
25
- decode('EIEXMSMESAORIWSCE', 5))
24
+ self.assertMultiLineEqual(
25
+ decode('EIEXMSMESAORIWSCE', 5), 'EXERCISMISAWESOME')
26
26
 
27
27
  def test_decode_with_six_rails(self):
28
28
  self.assertMultiLineEqual(
29
- '112358132134558914423337761098715972584418167651094617711286',
30
- decode('133714114238148966225439541018335470986172518171757571896261', 6)
31
- )
29
+ decode(
30
+ '133714114238148966225439541018335470986172518171757571896261',
31
+ 6),
32
+ '112358132134558914423337761098715972584418167651094617711286')
32
33
 
33
34
 
34
35
  if __name__ == '__main__':
@@ -5,52 +5,52 @@ from raindrops import raindrops
5
5
 
6
6
  class RaindropsTest(unittest.TestCase):
7
7
  def test_1(self):
8
- self.assertEqual("1", raindrops(1))
8
+ self.assertEqual(raindrops(1), "1")
9
9
 
10
10
  def test_3(self):
11
- self.assertEqual("Pling", raindrops(3))
11
+ self.assertEqual(raindrops(3), "Pling")
12
12
 
13
13
  def test_5(self):
14
- self.assertEqual("Plang", raindrops(5))
14
+ self.assertEqual(raindrops(5), "Plang")
15
15
 
16
16
  def test_7(self):
17
- self.assertEqual("Plong", raindrops(7))
17
+ self.assertEqual(raindrops(7), "Plong")
18
18
 
19
19
  def test_6(self):
20
- self.assertEqual("Pling", raindrops(6))
20
+ self.assertEqual(raindrops(6), "Pling")
21
21
 
22
22
  def test_9(self):
23
- self.assertEqual("Pling", raindrops(9))
23
+ self.assertEqual(raindrops(9), "Pling")
24
24
 
25
25
  def test_10(self):
26
- self.assertEqual("Plang", raindrops(10))
26
+ self.assertEqual(raindrops(10), "Plang")
27
27
 
28
28
  def test_14(self):
29
- self.assertEqual("Plong", raindrops(14))
29
+ self.assertEqual(raindrops(14), "Plong")
30
30
 
31
31
  def test_15(self):
32
- self.assertEqual("PlingPlang", raindrops(15))
32
+ self.assertEqual(raindrops(15), "PlingPlang")
33
33
 
34
34
  def test_21(self):
35
- self.assertEqual("PlingPlong", raindrops(21))
35
+ self.assertEqual(raindrops(21), "PlingPlong")
36
36
 
37
37
  def test_25(self):
38
- self.assertEqual("Plang", raindrops(25))
38
+ self.assertEqual(raindrops(25), "Plang")
39
39
 
40
40
  def test_35(self):
41
- self.assertEqual("PlangPlong", raindrops(35))
41
+ self.assertEqual(raindrops(35), "PlangPlong")
42
42
 
43
43
  def test_49(self):
44
- self.assertEqual("Plong", raindrops(49))
44
+ self.assertEqual(raindrops(49), "Plong")
45
45
 
46
46
  def test_52(self):
47
- self.assertEqual("52", raindrops(52))
47
+ self.assertEqual(raindrops(52), "52")
48
48
 
49
49
  def test_105(self):
50
- self.assertEqual("PlingPlangPlong", raindrops(105))
50
+ self.assertEqual(raindrops(105), "PlingPlangPlong")
51
51
 
52
52
  def test_12121(self):
53
- self.assertEqual("12121", raindrops(12121))
53
+ self.assertEqual(raindrops(12121), "12121")
54
54
 
55
55
 
56
56
  if __name__ == '__main__':
@@ -5,21 +5,21 @@ from rectangles import count
5
5
 
6
6
  class WordTest(unittest.TestCase):
7
7
  def test_zero_area_1(self):
8
- self.assertEqual(0, count())
8
+ self.assertEqual(count(), 0)
9
9
 
10
10
  def test_zero_area_2(self):
11
11
  lines = ""
12
- self.assertEqual(0, count(lines))
12
+ self.assertEqual(count(lines), 0)
13
13
 
14
14
  def test_empty_area(self):
15
15
  lines = " "
16
- self.assertEqual(0, count(lines))
16
+ self.assertEqual(count(lines), 0)
17
17
 
18
18
  def test_one_rectangle(self):
19
19
  lines = ["+-+",
20
20
  "| |",
21
21
  "+-+"]
22
- self.assertEqual(1, count(lines))
22
+ self.assertEqual(count(lines), 1)
23
23
 
24
24
  def test_two_rectangles_no_shared_parts(self):
25
25
  lines = [" +-+",
@@ -27,7 +27,7 @@ class WordTest(unittest.TestCase):
27
27
  "+-+-+",
28
28
  "| | ",
29
29
  "+-+ "]
30
- self.assertEqual(2, count(lines))
30
+ self.assertEqual(count(lines), 2)
31
31
 
32
32
  def test_five_rectangles_three_regions(self):
33
33
  lines = [" +-+",
@@ -35,7 +35,7 @@ class WordTest(unittest.TestCase):
35
35
  "+-+-+",
36
36
  "| | |",
37
37
  "+-+-+"]
38
- self.assertEqual(5, count(lines))
38
+ self.assertEqual(count(lines), 5)
39
39
 
40
40
  def test_incomplete_rectangles(self):
41
41
  lines = [" +-+",
@@ -43,7 +43,7 @@ class WordTest(unittest.TestCase):
43
43
  "+-+-+",
44
44
  "| | -",
45
45
  "+-+-+"]
46
- self.assertEqual(1, count(lines))
46
+ self.assertEqual(count(lines), 1)
47
47
 
48
48
  def test_complicated(self):
49
49
  lines = ["+------+----+",
@@ -51,7 +51,7 @@ class WordTest(unittest.TestCase):
51
51
  "+---+--+ |",
52
52
  "| | |",
53
53
  "+---+-------+"]
54
- self.assertEqual(3, count(lines))
54
+ self.assertEqual(count(lines), 3)
55
55
 
56
56
  def test_not_so_complicated(self):
57
57
  lines = ["+------+----+",
@@ -59,7 +59,7 @@ class WordTest(unittest.TestCase):
59
59
  "+------+ |",
60
60
  "| | |",
61
61
  "+---+-------+"]
62
- self.assertEqual(2, count(lines))
62
+ self.assertEqual(count(lines), 2)
63
63
 
64
64
 
65
65
  if __name__ == '__main__':
@@ -7,28 +7,28 @@ from rna_transcription import to_rna
7
7
 
8
8
  class DNATests(unittest.TestCase):
9
9
  def test_transcribes_guanine_to_cytosine(self):
10
- self.assertEqual('C', to_rna('G'))
10
+ self.assertEqual(to_rna('G'), 'C')
11
11
 
12
12
  def test_transcribes_cytosine_to_guanine(self):
13
- self.assertEqual('G', to_rna('C'))
13
+ self.assertEqual(to_rna('C'), 'G')
14
14
 
15
15
  def test_transcribes_thymine_to_adenine(self):
16
- self.assertEqual('A', to_rna('T'))
16
+ self.assertEqual(to_rna('T'), 'A')
17
17
 
18
18
  def test_transcribes_adenine_to_uracil(self):
19
- self.assertEqual('U', to_rna('A'))
19
+ self.assertEqual(to_rna('A'), 'U')
20
20
 
21
21
  def test_transcribes_all_occurences(self):
22
- self.assertMultiLineEqual('UGCACCAGAAUU', to_rna('ACGTGGTCTTAA'))
22
+ self.assertMultiLineEqual(to_rna('ACGTGGTCTTAA'), 'UGCACCAGAAUU')
23
23
 
24
24
  def test_correctly_handles_single_invalid_input(self):
25
- self.assertEqual('', to_rna('U'))
25
+ self.assertEqual(to_rna('U'), '')
26
26
 
27
27
  def test_correctly_handles_completely_invalid_input(self):
28
- self.assertMultiLineEqual('', to_rna('XXX'))
28
+ self.assertMultiLineEqual(to_rna('XXX'), '')
29
29
 
30
30
  def test_correctly_handles_partially_invalid_input(self):
31
- self.assertMultiLineEqual('', to_rna('ACGTXXXCTTAA'))
31
+ self.assertMultiLineEqual(to_rna('ACGTXXXCTTAA'), '')
32
32
 
33
33
 
34
34
  if __name__ == '__main__':
@@ -1,7 +1,7 @@
1
1
  import unittest
2
+ import random
2
3
 
3
4
  from robot_name import Robot
4
- import random
5
5
 
6
6
 
7
7
  class RobotTest(unittest.TestCase):
@@ -4,16 +4,15 @@ from robot_simulator import Robot, NORTH, EAST, SOUTH, WEST
4
4
 
5
5
 
6
6
  class RobotTests(unittest.TestCase):
7
-
8
7
  def test_init(self):
9
8
  robot = Robot()
10
- self.assertEqual((0, 0), robot.coordinates)
11
- self.assertEqual(NORTH, robot.bearing)
9
+ self.assertEqual(robot.coordinates, (0, 0))
10
+ self.assertEqual(robot.bearing, NORTH)
12
11
 
13
12
  def test_setup(self):
14
13
  robot = Robot(SOUTH, -1, 1)
15
- self.assertEqual((-1, 1), robot.coordinates)
16
- self.assertEqual(SOUTH, robot.bearing)
14
+ self.assertEqual(robot.coordinates, (-1, 1))
15
+ self.assertEqual(robot.bearing, SOUTH)
17
16
 
18
17
  def test_turn_right(self):
19
18
  robot = Robot()
@@ -30,44 +29,44 @@ class RobotTests(unittest.TestCase):
30
29
  def test_advance_positive_north(self):
31
30
  robot = Robot(NORTH, 0, 0)
32
31
  robot.advance()
33
- self.assertEqual((0, 1), robot.coordinates)
34
- self.assertEqual(NORTH, robot.bearing)
32
+ self.assertEqual(robot.coordinates, (0, 1))
33
+ self.assertEqual(robot.bearing, NORTH)
35
34
 
36
35
  def test_advance_positive_east(self):
37
36
  robot = Robot(EAST, 0, 0)
38
37
  robot.advance()
39
- self.assertEqual((1, 0), robot.coordinates)
40
- self.assertEqual(EAST, robot.bearing)
38
+ self.assertEqual(robot.coordinates, (1, 0))
39
+ self.assertEqual(robot.bearing, EAST)
41
40
 
42
41
  def test_advance_negative_south(self):
43
42
  robot = Robot(SOUTH, 0, 0)
44
43
  robot.advance()
45
- self.assertEqual((0, -1), robot.coordinates)
46
- self.assertEqual(SOUTH, robot.bearing)
44
+ self.assertEqual(robot.coordinates, (0, -1))
45
+ self.assertEqual(robot.bearing, SOUTH)
47
46
 
48
47
  def test_advance_positive_west(self):
49
48
  robot = Robot(WEST, 0, 0)
50
49
  robot.advance()
51
- self.assertEqual((-1, 0), robot.coordinates)
52
- self.assertEqual(WEST, robot.bearing)
50
+ self.assertEqual(robot.coordinates, (-1, 0))
51
+ self.assertEqual(robot.bearing, WEST)
53
52
 
54
53
  def test_simulate_prog1(self):
55
54
  robot = Robot(NORTH, 0, 0)
56
55
  robot.simulate("LAAARALA")
57
- self.assertEqual((-4, 1), robot.coordinates)
58
- self.assertEqual(WEST, robot.bearing)
56
+ self.assertEqual(robot.coordinates, (-4, 1))
57
+ self.assertEqual(robot.bearing, WEST)
59
58
 
60
59
  def test_simulate_prog2(self):
61
60
  robot = Robot(EAST, 2, -7)
62
61
  robot.simulate("RRAAAAALA")
63
- self.assertEqual((-3, -8), robot.coordinates)
64
- self.assertEqual(SOUTH, robot.bearing)
62
+ self.assertEqual(robot.coordinates, (-3, -8))
63
+ self.assertEqual(robot.bearing, SOUTH)
65
64
 
66
65
  def test_simulate_prog3(self):
67
66
  robot = Robot(SOUTH, 8, 4)
68
67
  robot.simulate("LAAARRRALLLL")
69
- self.assertEqual((11, 5), robot.coordinates)
70
- self.assertEqual(NORTH, robot.bearing)
68
+ self.assertEqual(robot.coordinates, (11, 5))
69
+ self.assertEqual(robot.bearing, NORTH)
71
70
 
72
71
 
73
72
  if __name__ == '__main__':
@@ -27,7 +27,7 @@ class RomanTest(unittest.TestCase):
27
27
 
28
28
  def test_numerals(self):
29
29
  for arabic, numeral in self.numerals.items():
30
- self.assertEqual(numeral, roman_numerals.numeral(arabic))
30
+ self.assertEqual(roman_numerals.numeral(arabic), numeral)
31
31
 
32
32
 
33
33
  if __name__ == '__main__':
@@ -4,49 +4,48 @@ from run_length_encoding import encode, decode
4
4
 
5
5
 
6
6
  class WordCountTests(unittest.TestCase):
7
-
8
7
  def test_encode_empty_string(self):
9
- self.assertMultiLineEqual('', encode(''))
8
+ self.assertMultiLineEqual(encode(''), '')
10
9
 
11
10
  def test_encode_single_characters_only_are_encoded_without_count(self):
12
- self.assertMultiLineEqual('XYZ', encode('XYZ'))
11
+ self.assertMultiLineEqual(encode('XYZ'), 'XYZ')
13
12
 
14
13
  def test_encode_string_with_no_single_characters(self):
15
- self.assertMultiLineEqual('2A3B4C', encode('AABBBCCCC'))
14
+ self.assertMultiLineEqual(encode('AABBBCCCC'), '2A3B4C')
16
15
 
17
16
  def test_encode_single_characters_mixed_with_repeated_characters(self):
18
17
  self.assertMultiLineEqual(
19
- '12WB12W3B24WB',
20
- encode('WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB'))
18
+ encode('WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB'),
19
+ '12WB12W3B24WB')
21
20
 
22
21
  def test_encode_multiple_whitespace_mixed_in_string(self):
23
- self.assertMultiLineEqual('2 hs2q q2w2 ', encode(' hsqq qww '))
22
+ self.assertMultiLineEqual(encode(' hsqq qww '), '2 hs2q q2w2 ')
24
23
 
25
24
  def test_encode_lowercase_characters(self):
26
- self.assertMultiLineEqual('2a3b4c', encode('aabbbcccc'))
25
+ self.assertMultiLineEqual(encode('aabbbcccc'), '2a3b4c')
27
26
 
28
27
  def test_decode_empty_string(self):
29
- self.assertMultiLineEqual('', decode(''))
28
+ self.assertMultiLineEqual(decode(''), '')
30
29
 
31
30
  def test_decode_single_characters_only(self):
32
- self.assertMultiLineEqual('XYZ', decode('XYZ'))
31
+ self.assertMultiLineEqual(decode('XYZ'), 'XYZ')
33
32
 
34
33
  def test_decode_string_with_no_single_characters(self):
35
- self.assertMultiLineEqual('AABBBCCCC', decode('2A3B4C'))
34
+ self.assertMultiLineEqual(decode('2A3B4C'), 'AABBBCCCC')
36
35
 
37
36
  def test_decode_single_characters_with_repeated_characters(self):
38
37
  self.assertMultiLineEqual(
39
- 'WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB',
40
- decode('12WB12W3B24WB'))
38
+ decode('12WB12W3B24WB'),
39
+ 'WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB')
41
40
 
42
41
  def test_decode_multiple_whitespace_mixed_in_string(self):
43
- self.assertMultiLineEqual(' hsqq qww ', decode('2 hs2q q2w2 '))
42
+ self.assertMultiLineEqual(decode('2 hs2q q2w2 '), ' hsqq qww ')
44
43
 
45
44
  def test_decode_lower_case_string(self):
46
- self.assertMultiLineEqual('aabbbcccc', decode('2a3b4c'))
45
+ self.assertMultiLineEqual(decode('2a3b4c'), 'aabbbcccc')
47
46
 
48
47
  def test_combination(self):
49
- self.assertMultiLineEqual('zzz ZZ zZ', decode(encode('zzz ZZ zZ')))
48
+ self.assertMultiLineEqual(decode(encode('zzz ZZ zZ')), 'zzz ZZ zZ')
50
49
 
51
50
 
52
51
  if __name__ == '__main__':
@@ -13,18 +13,18 @@ from saddle_points import saddle_points
13
13
  class SaddlePointTest(unittest.TestCase):
14
14
  def test_one_saddle(self):
15
15
  inp = [[9, 8, 7], [5, 3, 2], [6, 6, 7]]
16
- self.assertEqual(set([(1, 0)]), saddle_points(inp))
16
+ self.assertEqual(saddle_points(inp), set([(1, 0)]))
17
17
 
18
18
  def test_no_saddle(self):
19
- self.assertEqual(set(), saddle_points([[2, 1], [1, 2]]))
19
+ self.assertEqual(saddle_points([[2, 1], [1, 2]]), set())
20
20
 
21
21
  def test_mult_saddle(self):
22
22
  inp = [[5, 3, 5, 4], [6, 4, 7, 3], [5, 1, 5, 3]]
23
23
  ans = set([(0, 0), (0, 2), (2, 0), (2, 2)])
24
- self.assertEqual(ans, saddle_points(inp))
24
+ self.assertEqual(saddle_points(inp), ans)
25
25
 
26
26
  def test_empty_matrix(self):
27
- self.assertEqual(set(), saddle_points([]))
27
+ self.assertEqual(saddle_points([]), set())
28
28
 
29
29
  def test_irregular_matrix(self):
30
30
  inp = [[3, 2, 1], [0, 1], [2, 1, 0]]