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
@@ -4,26 +4,27 @@ from binary_search import binary_search
4
4
 
5
5
 
6
6
  class BinarySearchTests(unittest.TestCase):
7
-
8
7
  def test_finds_value_in_array_with_one_element(self):
9
- self.assertEqual(0, binary_search([6], 6))
8
+ self.assertEqual(binary_search([6], 6), 0)
10
9
 
11
10
  def test_finds_value_in_middle_of_array(self):
12
- self.assertEqual(3, binary_search([1, 3, 4, 6, 8, 9, 11], 6))
11
+ self.assertEqual(binary_search([1, 3, 4, 6, 8, 9, 11], 6), 3)
13
12
 
14
13
  def test_finds_value_at_beginning_of_array(self):
15
- self.assertEqual(0, binary_search([1, 3, 4, 6, 8, 9, 11], 1))
14
+ self.assertEqual(binary_search([1, 3, 4, 6, 8, 9, 11], 1), 0)
16
15
 
17
16
  def test_finds_value_at_end_of_array(self):
18
- self.assertEqual(6, binary_search([1, 3, 4, 6, 8, 9, 11], 11))
17
+ self.assertEqual(binary_search([1, 3, 4, 6, 8, 9, 11], 11), 6)
19
18
 
20
19
  def test_finds_value_in_array_of_odd_length(self):
21
- self.assertEqual(9, binary_search(
22
- [1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 634], 144))
20
+ self.assertEqual(
21
+ binary_search([1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 634],
22
+ 144), 9)
23
23
 
24
24
  def test_finds_value_in_array_of_even_length(self):
25
- self.assertEqual(5, binary_search(
26
- [1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377], 21))
25
+ self.assertEqual(
26
+ binary_search([1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377], 21),
27
+ 5)
27
28
 
28
29
  def test_identifies_value_missing(self):
29
30
  self.assertRaises(ValueError, binary_search, [1, 3, 4, 6, 8, 9, 11], 7)
@@ -32,7 +33,8 @@ class BinarySearchTests(unittest.TestCase):
32
33
  self.assertRaises(ValueError, binary_search, [1, 3, 4, 6, 8, 9, 11], 0)
33
34
 
34
35
  def test_value_larger_than_arrays_maximum(self):
35
- self.assertRaises(ValueError, binary_search, [1, 3, 4, 6, 8, 9, 11], 13)
36
+ self.assertRaises(ValueError, binary_search, [1, 3, 4, 6, 8, 9, 11],
37
+ 13)
36
38
 
37
39
  def test_empty_array(self):
38
40
  self.assertRaises(ValueError, binary_search, [], 1)
@@ -10,27 +10,26 @@ from binary import parse_binary
10
10
 
11
11
 
12
12
  class BinaryTests(unittest.TestCase):
13
-
14
13
  def test_binary_1_is_decimal_1(self):
15
- self.assertEqual(1, parse_binary("1"))
14
+ self.assertEqual(parse_binary("1"), 1)
16
15
 
17
16
  def test_binary_10_is_decimal_2(self):
18
- self.assertEqual(2, parse_binary("10"))
17
+ self.assertEqual(parse_binary("10"), 2)
19
18
 
20
19
  def test_binary_11_is_decimal_3(self):
21
- self.assertEqual(3, parse_binary("11"))
20
+ self.assertEqual(parse_binary("11"), 3)
22
21
 
23
22
  def test_binary_100_is_decimal_4(self):
24
- self.assertEqual(4, parse_binary("100"))
23
+ self.assertEqual(parse_binary("100"), 4)
25
24
 
26
25
  def test_binary_1001_is_decimal_9(self):
27
- self.assertEqual(9, parse_binary("1001"))
26
+ self.assertEqual(parse_binary("1001"), 9)
28
27
 
29
28
  def test_binary_11010_is_decimal_26(self):
30
- self.assertEqual(26, parse_binary("11010"))
29
+ self.assertEqual(parse_binary("11010"), 26)
31
30
 
32
31
  def test_binary_10001101000_is_decimal_1128(self):
33
- self.assertEqual(1128, parse_binary("10001101000"))
32
+ self.assertEqual(parse_binary("10001101000"), 1128)
34
33
 
35
34
  def test_invalid_binary_text_only(self):
36
35
  self.assertRaises(ValueError, parse_binary, "carrot")
@@ -8,7 +8,6 @@ from circular_buffer import (
8
8
 
9
9
 
10
10
  class CircularBufferTest(unittest.TestCase):
11
-
12
11
  def test_read_empty_buffer(self):
13
12
  buf = CircularBuffer(1)
14
13
  with self.assertRaises(BufferEmptyException):
@@ -25,8 +24,8 @@ class CircularBufferTest(unittest.TestCase):
25
24
  buf = CircularBuffer(2)
26
25
  buf.write('1')
27
26
  buf.write('2')
28
- self.assertEqual('1', buf.read())
29
- self.assertEqual('2', buf.read())
27
+ self.assertEqual(buf.read(), '1')
28
+ self.assertEqual(buf.read(), '2')
30
29
  with self.assertRaises(BufferEmptyException):
31
30
  buf.read()
32
31
 
@@ -39,16 +38,16 @@ class CircularBufferTest(unittest.TestCase):
39
38
  buf.read()
40
39
  buf.write('1')
41
40
  buf.write('2')
42
- self.assertEqual('1', buf.read())
41
+ self.assertEqual(buf.read(), '1')
43
42
  buf.write('3')
44
- self.assertEqual('2', buf.read())
43
+ self.assertEqual(buf.read(), '2')
45
44
 
46
45
  def test_alternate_write_and_read(self):
47
46
  buf = CircularBuffer(2)
48
47
  buf.write('1')
49
- self.assertEqual('1', buf.read())
48
+ self.assertEqual(buf.read(), '1')
50
49
  buf.write('2')
51
- self.assertEqual('2', buf.read())
50
+ self.assertEqual(buf.read(), '2')
52
51
 
53
52
  def test_read_back_oldest_item(self):
54
53
  buf = CircularBuffer(3)
@@ -57,7 +56,7 @@ class CircularBufferTest(unittest.TestCase):
57
56
  buf.read()
58
57
  buf.write('3')
59
58
  buf.read()
60
- self.assertEqual('3', buf.read())
59
+ self.assertEqual(buf.read(), '3')
61
60
 
62
61
  def test_write_full_buffer(self):
63
62
  buf = CircularBuffer(2)
@@ -71,8 +70,8 @@ class CircularBufferTest(unittest.TestCase):
71
70
  buf.write('1')
72
71
  buf.write('2')
73
72
  buf.overwrite('A')
74
- self.assertEqual('2', buf.read())
75
- self.assertEqual('A', buf.read())
73
+ self.assertEqual(buf.read(), '2')
74
+ self.assertEqual(buf.read(), 'A')
76
75
  with self.assertRaises(BufferEmptyException):
77
76
  buf.read()
78
77
 
@@ -80,8 +79,8 @@ class CircularBufferTest(unittest.TestCase):
80
79
  buf = CircularBuffer(2)
81
80
  buf.overwrite('1')
82
81
  buf.overwrite('2')
83
- self.assertEqual('1', buf.read())
84
- self.assertEqual('2', buf.read())
82
+ self.assertEqual(buf.read(), '1')
83
+ self.assertEqual(buf.read(), '2')
85
84
  with self.assertRaises(BufferEmptyException):
86
85
  buf.read()
87
86
 
@@ -97,11 +96,11 @@ class CircularBufferTest(unittest.TestCase):
97
96
  buf.write(c)
98
97
  buf.overwrite('A')
99
98
  buf.overwrite('B')
100
- self.assertEqual('6', buf.read())
101
- self.assertEqual('7', buf.read())
102
- self.assertEqual('8', buf.read())
103
- self.assertEqual('A', buf.read())
104
- self.assertEqual('B', buf.read())
99
+ self.assertEqual(buf.read(), '6')
100
+ self.assertEqual(buf.read(), '7')
101
+ self.assertEqual(buf.read(), '8')
102
+ self.assertEqual(buf.read(), 'A')
103
+ self.assertEqual(buf.read(), 'B')
105
104
  with self.assertRaises(BufferEmptyException):
106
105
  buf.read()
107
106
 
@@ -6,110 +6,110 @@ from clock import Clock
6
6
  class ClockTest(unittest.TestCase):
7
7
  # Test creating a new clock with an initial time.
8
8
  def test_on_the_hour(self):
9
- self.assertEqual('08:00', str(Clock(8, 0)))
9
+ self.assertEqual(str(Clock(8, 0)), '08:00')
10
10
 
11
11
  def test_past_the_hour(self):
12
- self.assertEqual('11:09', str(Clock(11, 9)))
12
+ self.assertEqual(str(Clock(11, 9)), '11:09')
13
13
 
14
14
  def test_midnight_is_zero_hours(self):
15
- self.assertEqual('00:00', str(Clock(24, 0)))
15
+ self.assertEqual(str(Clock(24, 0)), '00:00')
16
16
 
17
17
  def test_hour_rolls_over(self):
18
- self.assertEqual('01:00', str(Clock(25, 0)))
18
+ self.assertEqual(str(Clock(25, 0)), '01:00')
19
19
 
20
20
  def test_hour_rolls_over_continuously(self):
21
- self.assertEqual('04:00', str(Clock(100, 0)))
21
+ self.assertEqual(str(Clock(100, 0)), '04:00')
22
22
 
23
23
  def test_sixty_minutes_is_next_hour(self):
24
- self.assertEqual('02:00', str(Clock(1, 60)))
24
+ self.assertEqual(str(Clock(1, 60)), '02:00')
25
25
 
26
26
  def test_minutes_roll_over(self):
27
- self.assertEqual('02:40', str(Clock(0, 160)))
27
+ self.assertEqual(str(Clock(0, 160)), '02:40')
28
28
 
29
29
  def test_minutes_roll_over_continuously(self):
30
- self.assertEqual('04:43', str(Clock(0, 1723)))
30
+ self.assertEqual(str(Clock(0, 1723)), '04:43')
31
31
 
32
32
  def test_hour_and_minutes_roll_over(self):
33
- self.assertEqual('03:40', str(Clock(25, 160)))
33
+ self.assertEqual(str(Clock(25, 160)), '03:40')
34
34
 
35
35
  def test_hour_and_minutes_roll_over_continuously(self):
36
- self.assertEqual('11:01', str(Clock(201, 3001)))
36
+ self.assertEqual(str(Clock(201, 3001)), '11:01')
37
37
 
38
38
  def test_hour_and_minutes_roll_over_to_exactly_midnight(self):
39
- self.assertEqual('00:00', str(Clock(72, 8640)))
39
+ self.assertEqual(str(Clock(72, 8640)), '00:00')
40
40
 
41
41
  def test_negative_hour(self):
42
- self.assertEqual('23:15', str(Clock(-1, 15)))
42
+ self.assertEqual(str(Clock(-1, 15)), '23:15')
43
43
 
44
44
  def test_negative_hour_rolls_over(self):
45
- self.assertEqual('23:00', str(Clock(-25, 0)))
45
+ self.assertEqual(str(Clock(-25, 0)), '23:00')
46
46
 
47
47
  def test_negative_hour_rolls_over_continuously(self):
48
- self.assertEqual('05:00', str(Clock(-91, 0)))
48
+ self.assertEqual(str(Clock(-91, 0)), '05:00')
49
49
 
50
50
  def test_negative_minutes(self):
51
- self.assertEqual('00:20', str(Clock(1, -40)))
51
+ self.assertEqual(str(Clock(1, -40)), '00:20')
52
52
 
53
53
  def test_negative_minutes_roll_over(self):
54
- self.assertEqual('22:20', str(Clock(1, -160)))
54
+ self.assertEqual(str(Clock(1, -160)), '22:20')
55
55
 
56
56
  def test_negative_minutes_roll_over_continuously(self):
57
- self.assertEqual('16:40', str(Clock(1, -4820)))
57
+ self.assertEqual(str(Clock(1, -4820)), '16:40')
58
58
 
59
59
  def test_negative_hour_and_minutes_both_roll_over(self):
60
- self.assertEqual('20:20', str(Clock(-25, -160)))
60
+ self.assertEqual(str(Clock(-25, -160)), '20:20')
61
61
 
62
62
  def test_negative_hour_and_minutes_both_roll_over_continuously(self):
63
- self.assertEqual('22:10', str(Clock(-121, -5810)))
63
+ self.assertEqual(str(Clock(-121, -5810)), '22:10')
64
64
 
65
65
  # Test adding and subtracting minutes.
66
66
  def test_add_minutes(self):
67
- self.assertEqual('10:03', str(Clock(10, 0).add(3)))
67
+ self.assertEqual(str(Clock(10, 0).add(3)), '10:03')
68
68
 
69
69
  def test_add_no_minutes(self):
70
- self.assertEqual('06:41', str(Clock(6, 41).add(0)))
70
+ self.assertEqual(str(Clock(6, 41).add(0)), '06:41')
71
71
 
72
72
  def test_add_to_next_hour(self):
73
- self.assertEqual('01:25', str(Clock(0, 45).add(40)))
73
+ self.assertEqual(str(Clock(0, 45).add(40)), '01:25')
74
74
 
75
75
  def test_add_more_than_one_hour(self):
76
- self.assertEqual('11:01', str(Clock(10, 0).add(61)))
76
+ self.assertEqual(str(Clock(10, 0).add(61)), '11:01')
77
77
 
78
78
  def test_add_more_than_two_hours_with_carry(self):
79
- self.assertEqual('03:25', str(Clock(0, 45).add(160)))
79
+ self.assertEqual(str(Clock(0, 45).add(160)), '03:25')
80
80
 
81
81
  def test_add_across_midnight(self):
82
- self.assertEqual('00:01', str(Clock(23, 59).add(2)))
82
+ self.assertEqual(str(Clock(23, 59).add(2)), '00:01')
83
83
 
84
84
  def test_add_more_than_one_day(self):
85
- self.assertEqual('06:32', str(Clock(5, 32).add(1500)))
85
+ self.assertEqual(str(Clock(5, 32).add(1500)), '06:32')
86
86
 
87
87
  def test_add_more_than_two_days(self):
88
- self.assertEqual('11:21', str(Clock(1, 1).add(3500)))
88
+ self.assertEqual(str(Clock(1, 1).add(3500)), '11:21')
89
89
 
90
90
  def test_subtract_minutes(self):
91
- self.assertEqual('10:00', str(Clock(10, 3).add(-3)))
91
+ self.assertEqual(str(Clock(10, 3).add(-3)), '10:00')
92
92
 
93
93
  def test_subtract_to_previous_hour(self):
94
- self.assertEqual('10:00', str(Clock(10, 3).add(-3)))
94
+ self.assertEqual(str(Clock(10, 3).add(-3)), '10:00')
95
95
 
96
96
  def test_subtract_more_than_an_hour(self):
97
- self.assertEqual('09:33', str(Clock(10, 3).add(-30)))
97
+ self.assertEqual(str(Clock(10, 3).add(-30)), '09:33')
98
98
 
99
99
  def test_subtract_across_midnight(self):
100
- self.assertEqual('08:53', str(Clock(10, 3).add(-70)))
100
+ self.assertEqual(str(Clock(10, 3).add(-70)), '08:53')
101
101
 
102
102
  def test_subtract_more_than_two_hours(self):
103
- self.assertEqual('21:20', str(Clock(0, 0).add(-160)))
103
+ self.assertEqual(str(Clock(0, 0).add(-160)), '21:20')
104
104
 
105
105
  def test_subtract_more_than_two_hours_with_borrow(self):
106
- self.assertEqual('03:35', str(Clock(6, 15).add(-160)))
106
+ self.assertEqual(str(Clock(6, 15).add(-160)), '03:35')
107
107
 
108
108
  def test_subtract_more_than_one_day(self):
109
- self.assertEqual('04:32', str(Clock(5, 32).add(-1500)))
109
+ self.assertEqual(str(Clock(5, 32).add(-1500)), '04:32')
110
110
 
111
111
  def test_subtract_more_than_two_days(self):
112
- self.assertEqual('00:20', str(Clock(2, 20).add(-3000)))
112
+ self.assertEqual(str(Clock(2, 20).add(-3000)), '00:20')
113
113
 
114
114
  # Construct two separate clocks, set times, test if they are equal.
115
115
  def test_clocks_with_same_time(self):
@@ -4,26 +4,25 @@ from crypto_square import encode
4
4
 
5
5
 
6
6
  class CryptoSquareTest(unittest.TestCase):
7
-
8
7
  def test_empty_string(self):
9
- self.assertEqual('', encode(''))
8
+ self.assertEqual(encode(''), '')
10
9
 
11
10
  def test_perfect_square(self):
12
- self.assertEqual('ac bd', encode('ABCD'))
11
+ self.assertEqual(encode('ABCD'), 'ac bd')
13
12
 
14
13
  def test_small_imperfect_square(self):
15
- self.assertEqual('tis hsy ie sa', encode('This is easy!'))
14
+ self.assertEqual(encode('This is easy!'), 'tis hsy ie sa')
16
15
 
17
16
  def test_punctuation_and_numbers(self):
18
17
  msg = "1, 2, 3, Go! Go, for God's sake!"
19
18
  ciph = '1gga 2ook 3fde gos ors'
20
- self.assertEqual(ciph, encode(msg))
19
+ self.assertEqual(encode(msg), ciph)
21
20
 
22
21
  def test_long_string(self):
23
22
  msg = ("If man was meant to stay on the ground, god would have given "
24
23
  "us roots.")
25
24
  ciph = "imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau"
26
- self.assertEqual(ciph, encode(msg))
25
+ self.assertEqual(encode(msg), ciph)
27
26
 
28
27
 
29
28
  if __name__ == '__main__':
@@ -4,9 +4,8 @@ from diamond import make_diamond
4
4
 
5
5
 
6
6
  class DiamondTests(unittest.TestCase):
7
-
8
7
  def test_letter_A(self):
9
- self.assertMultiLineEqual('A\n', make_diamond('A'))
8
+ self.assertMultiLineEqual(make_diamond('A'), 'A\n')
10
9
 
11
10
  def test_letter_C(self):
12
11
  result = [' A ',
@@ -14,7 +13,7 @@ class DiamondTests(unittest.TestCase):
14
13
  'C C',
15
14
  ' B B ',
16
15
  ' A ']
17
- self.assertMultiLineEqual('\n'.join(result) + '\n', make_diamond('C'))
16
+ self.assertMultiLineEqual(make_diamond('C'), '\n'.join(result) + '\n')
18
17
 
19
18
  def test_letter_E(self):
20
19
  result = [' A ',
@@ -26,7 +25,7 @@ class DiamondTests(unittest.TestCase):
26
25
  ' C C ',
27
26
  ' B B ',
28
27
  ' A ']
29
- self.assertMultiLineEqual('\n'.join(result) + '\n', make_diamond('E'))
28
+ self.assertMultiLineEqual(make_diamond('E'), '\n'.join(result) + '\n')
30
29
 
31
30
 
32
31
  if __name__ == '__main__':
@@ -8,13 +8,13 @@ class TransformTest(unittest.TestCase):
8
8
  old = {1: ['WORLD']}
9
9
  expected = {'world': 1}
10
10
 
11
- self.assertEqual(expected, etl.transform(old))
11
+ self.assertEqual(etl.transform(old), expected)
12
12
 
13
13
  def test_transform_more_values(self):
14
14
  old = {1: ['WORLD', 'GSCHOOLERS']}
15
15
  expected = {'world': 1, 'gschoolers': 1}
16
16
 
17
- self.assertEqual(expected, etl.transform(old))
17
+ self.assertEqual(etl.transform(old), expected)
18
18
 
19
19
  def test_more_keys(self):
20
20
  old = {1: ['APPLE', 'ARTICHOKE'], 2: ['BOAT', 'BALLERINA']}
@@ -25,7 +25,7 @@ class TransformTest(unittest.TestCase):
25
25
  'ballerina': 2
26
26
  }
27
27
 
28
- self.assertEqual(expected, etl.transform(old))
28
+ self.assertEqual(etl.transform(old), expected)
29
29
 
30
30
  def test_full_dataset(self):
31
31
  old = {
@@ -47,7 +47,7 @@ class TransformTest(unittest.TestCase):
47
47
  "z": 10
48
48
  }
49
49
 
50
- self.assertEqual(expected, etl.transform(old))
50
+ self.assertEqual(etl.transform(old), expected)
51
51
 
52
52
 
53
53
  if __name__ == '__main__':
@@ -7,43 +7,35 @@ from gigasecond import add_gigasecond
7
7
  class GigasecondTest(unittest.TestCase):
8
8
  def test_1(self):
9
9
  self.assertEqual(
10
- datetime(2043, 1, 1, 1, 46, 40),
11
- add_gigasecond(datetime(2011, 4, 25))
12
- )
10
+ add_gigasecond(datetime(2011, 4, 25)),
11
+ datetime(2043, 1, 1, 1, 46, 40))
13
12
 
14
13
  def test_2(self):
15
14
  self.assertEqual(
16
- datetime(2009, 2, 19, 1, 46, 40),
17
- add_gigasecond(datetime(1977, 6, 13))
18
- )
15
+ add_gigasecond(datetime(1977, 6, 13)),
16
+ datetime(2009, 2, 19, 1, 46, 40))
19
17
 
20
18
  def test_3(self):
21
19
  self.assertEqual(
22
- datetime(1991, 3, 27, 1, 46, 40),
23
- add_gigasecond(datetime(1959, 7, 19))
24
- )
20
+ add_gigasecond(datetime(1959, 7, 19)),
21
+ datetime(1991, 3, 27, 1, 46, 40))
25
22
 
26
23
  def test_4(self):
27
24
  self.assertEqual(
28
- datetime(2046, 10, 2, 23, 46, 40),
29
- add_gigasecond(datetime(2015, 1, 24, 22, 0, 0))
30
- )
25
+ add_gigasecond(datetime(2015, 1, 24, 22, 0, 0)),
26
+ datetime(2046, 10, 2, 23, 46, 40))
31
27
 
32
28
  def test_5(self):
33
29
  self.assertEqual(
34
- datetime(2046, 10, 3, 1, 46, 39),
35
- add_gigasecond(datetime(2015, 1, 24, 23, 59, 59))
36
- )
30
+ add_gigasecond(datetime(2015, 1, 24, 23, 59, 59)),
31
+ datetime(2046, 10, 3, 1, 46, 39))
37
32
 
38
33
  def test_yourself(self):
39
34
  # customize this to test your birthday and find your gigasecond date:
40
35
  your_birthday = datetime(1970, 1, 1)
41
36
  your_gigasecond = datetime(2001, 9, 9, 1, 46, 40)
42
37
 
43
- self.assertEqual(
44
- your_gigasecond,
45
- add_gigasecond(your_birthday)
46
- )
38
+ self.assertEqual(add_gigasecond(your_birthday), your_gigasecond)
47
39
 
48
40
 
49
41
  if __name__ == '__main__':