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
@@ -1,5 +1,5 @@
1
- from datetime import date
2
1
  import unittest
2
+ from datetime import date
3
3
 
4
4
  from meetup import meetup_day
5
5
 
@@ -11,56 +11,56 @@ except ImportError:
11
11
 
12
12
  class MeetupTest(unittest.TestCase):
13
13
  def test_monteenth_of_may_2013(self):
14
- self.assertEqual(date(2013, 5, 13),
15
- meetup_day(2013, 5, 'Monday', 'teenth'))
14
+ self.assertEqual(
15
+ meetup_day(2013, 5, 'Monday', 'teenth'), date(2013, 5, 13))
16
16
 
17
17
  def test_saturteenth_of_february_2013(self):
18
- self.assertEqual(date(2013, 2, 16),
19
- meetup_day(2013, 2, 'Saturday', 'teenth'))
18
+ self.assertEqual(
19
+ meetup_day(2013, 2, 'Saturday', 'teenth'), date(2013, 2, 16))
20
20
 
21
21
  def test_first_tuesday_of_may_2013(self):
22
- self.assertEqual(date(2013, 5, 7),
23
- meetup_day(2013, 5, 'Tuesday', '1st'))
22
+ self.assertEqual(
23
+ meetup_day(2013, 5, 'Tuesday', '1st'), date(2013, 5, 7))
24
24
 
25
25
  def test_second_monday_of_april_2013(self):
26
- self.assertEqual(date(2013, 4, 8),
27
- meetup_day(2013, 4, 'Monday', '2nd'))
26
+ self.assertEqual(
27
+ meetup_day(2013, 4, 'Monday', '2nd'), date(2013, 4, 8))
28
28
 
29
29
  def test_third_thursday_of_september_2013(self):
30
- self.assertEqual(date(2013, 9, 19),
31
- meetup_day(2013, 9, 'Thursday', '3rd'))
30
+ self.assertEqual(
31
+ meetup_day(2013, 9, 'Thursday', '3rd'), date(2013, 9, 19))
32
32
 
33
33
  def test_fourth_sunday_of_march_2013(self):
34
- self.assertEqual(date(2013, 3, 24),
35
- meetup_day(2013, 3, 'Sunday', '4th'))
34
+ self.assertEqual(
35
+ meetup_day(2013, 3, 'Sunday', '4th'), date(2013, 3, 24))
36
36
 
37
37
  def test_last_thursday_of_october_2013(self):
38
- self.assertEqual(date(2013, 10, 31),
39
- meetup_day(2013, 10, 'Thursday', 'last'))
38
+ self.assertEqual(
39
+ meetup_day(2013, 10, 'Thursday', 'last'), date(2013, 10, 31))
40
40
 
41
41
  def test_last_wednesday_of_february_2012(self):
42
- self.assertEqual(date(2012, 2, 29),
43
- meetup_day(2012, 2, 'Wednesday', 'last'))
42
+ self.assertEqual(
43
+ meetup_day(2012, 2, 'Wednesday', 'last'), date(2012, 2, 29))
44
44
 
45
45
  def test_last_wednesday_of_december_2014(self):
46
- self.assertEqual(date(2014, 12, 31),
47
- meetup_day(2014, 12, 'Wednesday', 'last'))
46
+ self.assertEqual(
47
+ meetup_day(2014, 12, 'Wednesday', 'last'), date(2014, 12, 31))
48
48
 
49
49
  def test_last_sunday_of_only_four_week_february_2015(self):
50
- self.assertEqual(date(2015, 2, 22),
51
- meetup_day(2015, 2, 'Sunday', 'last'))
50
+ self.assertEqual(
51
+ meetup_day(2015, 2, 'Sunday', 'last'), date(2015, 2, 22))
52
52
 
53
53
  def test_first_friday_of_december_2012(self):
54
- self.assertEqual(date(2012, 12, 7),
55
- meetup_day(2012, 12, 'Friday', '1st'))
54
+ self.assertEqual(
55
+ meetup_day(2012, 12, 'Friday', '1st'), date(2012, 12, 7))
56
56
 
57
57
  def test_fifth_monday_of_march_2015(self):
58
- self.assertEqual(date(2015, 3, 30),
59
- meetup_day(2015, 3, 'Monday', '5th'))
58
+ self.assertEqual(
59
+ meetup_day(2015, 3, 'Monday', '5th'), date(2015, 3, 30))
60
60
 
61
61
  def test_nonexistent_fifth_monday_of_february_2015(self):
62
- self.assertRaises(MeetupDayException, meetup_day,
63
- 2015, 2, 'Monday', '5th')
62
+ self.assertRaises(MeetupDayException, meetup_day, 2015, 2, 'Monday',
63
+ '5th')
64
64
 
65
65
 
66
66
  if __name__ == '__main__':
@@ -32,6 +32,8 @@ def verify_board(inp):
32
32
  if cset - set('+- *|'):
33
33
  raise ValueError("Invalid board")
34
34
  # Borders not as expected
35
- if any(inp[i1] != '+' + '-' * (rowlen - 2) + '+' for i1 in [0, -1]) or \
36
- any(inp[i1][i2] != '|' for i1 in range(1, collen - 1) for i2 in [0, -1]):
35
+ if any(inp[i1] != '+' + '-' * (rowlen - 2) + '+'
36
+ for i1 in [0, -1]) or any(inp[i1][i2] != '|'
37
+ for i1 in range(1, collen - 1)
38
+ for i2 in [0, -1]):
37
39
  raise ValueError("Invalid board")
@@ -29,7 +29,7 @@ class MinesweeperTest(unittest.TestCase):
29
29
  "|1*22*2|",
30
30
  "|111111|",
31
31
  "+------+"]
32
- self.assertEqual(out, board(inp))
32
+ self.assertEqual(board(inp), out)
33
33
 
34
34
  def test_board2(self):
35
35
  inp = ["+-----+",
@@ -46,7 +46,7 @@ class MinesweeperTest(unittest.TestCase):
46
46
  "|12*4*|",
47
47
  "|1*3*2|",
48
48
  "+-----+"]
49
- self.assertEqual(out, board(inp))
49
+ self.assertEqual(board(inp), out)
50
50
 
51
51
  def test_board3(self):
52
52
  inp = ["+-----+",
@@ -55,7 +55,7 @@ class MinesweeperTest(unittest.TestCase):
55
55
  out = ["+-----+",
56
56
  "|1*2*1|",
57
57
  "+-----+"]
58
- self.assertEqual(out, board(inp))
58
+ self.assertEqual(board(inp), out)
59
59
 
60
60
  def test_board4(self):
61
61
  inp = ["+-+",
@@ -72,7 +72,7 @@ class MinesweeperTest(unittest.TestCase):
72
72
  "|1|",
73
73
  "| |",
74
74
  "+-+"]
75
- self.assertEqual(out, board(inp))
75
+ self.assertEqual(board(inp), out)
76
76
 
77
77
  def test_board5(self):
78
78
  inp = ["+-+",
@@ -81,7 +81,7 @@ class MinesweeperTest(unittest.TestCase):
81
81
  out = ["+-+",
82
82
  "|*|",
83
83
  "+-+"]
84
- self.assertEqual(out, board(inp))
84
+ self.assertEqual(board(inp), out)
85
85
 
86
86
  def test_board6(self):
87
87
  inp = ["+--+",
@@ -92,7 +92,7 @@ class MinesweeperTest(unittest.TestCase):
92
92
  "|**|",
93
93
  "|**|",
94
94
  "+--+"]
95
- self.assertEqual(out, board(inp))
95
+ self.assertEqual(board(inp), out)
96
96
 
97
97
  def test_board7(self):
98
98
  inp = ["+--+",
@@ -103,7 +103,7 @@ class MinesweeperTest(unittest.TestCase):
103
103
  "|**|",
104
104
  "|**|",
105
105
  "+--+"]
106
- self.assertEqual(out, board(inp))
106
+ self.assertEqual(board(inp), out)
107
107
 
108
108
  def test_board8(self):
109
109
  inp = ["+---+",
@@ -116,7 +116,7 @@ class MinesweeperTest(unittest.TestCase):
116
116
  "|*8*|",
117
117
  "|***|",
118
118
  "+---+"]
119
- self.assertEqual(out, board(inp))
119
+ self.assertEqual(board(inp), out)
120
120
 
121
121
  def test_board9(self):
122
122
  inp = ["+-----+",
@@ -133,7 +133,7 @@ class MinesweeperTest(unittest.TestCase):
133
133
  "|111 |",
134
134
  "|1*1 |",
135
135
  "+-----+"]
136
- self.assertEqual(out, board(inp))
136
+ self.assertEqual(board(inp), out)
137
137
 
138
138
  def test_different_len(self):
139
139
  inp = ["+-+",
@@ -11,21 +11,21 @@ from nucleotide_count import count, nucleotide_counts
11
11
 
12
12
  class DNATest(unittest.TestCase):
13
13
  def test_empty_dna_string_has_no_adenosine(self):
14
- self.assertEqual(0, count('', 'A'))
14
+ self.assertEqual(count('', 'A'), 0)
15
15
 
16
16
  def test_empty_dna_string_has_no_nucleotides(self):
17
17
  expected = {'A': 0, 'T': 0, 'C': 0, 'G': 0}
18
- self.assertEqual(expected, nucleotide_counts(""))
18
+ self.assertEqual(nucleotide_counts(""), expected)
19
19
 
20
20
  def test_repetitive_cytidine_gets_counted(self):
21
- self.assertEqual(5, count('CCCCC', 'C'))
21
+ self.assertEqual(count('CCCCC', 'C'), 5)
22
22
 
23
23
  def test_repetitive_sequence_has_only_guanosine(self):
24
24
  expected = {'A': 0, 'T': 0, 'C': 0, 'G': 8}
25
- self.assertEqual(expected, nucleotide_counts('GGGGGGGG'))
25
+ self.assertEqual(nucleotide_counts('GGGGGGGG'), expected)
26
26
 
27
27
  def test_counts_only_thymidine(self):
28
- self.assertEqual(1, count('GGGGGTAACCCGG', 'T'))
28
+ self.assertEqual(count('GGGGGTAACCCGG', 'T'), 1)
29
29
 
30
30
  def test_validates_nucleotides(self):
31
31
  with self.assertRaises(ValueError):
@@ -35,7 +35,7 @@ class DNATest(unittest.TestCase):
35
35
  dna = ('AGCTTTTCATTCTGACTGCAACGGGCAATATGTCT'
36
36
  'CTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC')
37
37
  expected = {'A': 20, 'T': 21, 'G': 17, 'C': 12}
38
- self.assertEqual(expected, nucleotide_counts(dna))
38
+ self.assertEqual(nucleotide_counts(dna), expected)
39
39
 
40
40
 
41
41
  if __name__ == '__main__':
@@ -12,36 +12,35 @@ from ocr_numbers import grid, number
12
12
 
13
13
 
14
14
  class OcrTest(unittest.TestCase):
15
-
16
15
  def test_0(self):
17
- self.assertEqual('0', number([" _ ",
18
- "| |",
19
- "|_|",
20
- " "]))
16
+ self.assertEqual(number([" _ ",
17
+ "| |",
18
+ "|_|",
19
+ " "]), '0')
21
20
 
22
21
  def test_1(self):
23
- self.assertEqual('1', number([" ",
24
- " |",
25
- " |",
26
- " "]))
22
+ self.assertEqual(number([" ",
23
+ " |",
24
+ " |",
25
+ " "]), '1')
27
26
 
28
27
  def test_garbage(self):
29
- self.assertEqual('?', number([" _ ",
30
- " _|",
31
- " |",
32
- " "]))
28
+ self.assertEqual(number([" _ ",
29
+ " _|",
30
+ " |",
31
+ " "]), '?')
33
32
 
34
33
  def test_last_line_nonblank(self):
35
- self.assertEqual('?', number([" ",
36
- " |",
37
- " |",
38
- "| |"]))
34
+ self.assertEqual(number([" ",
35
+ " |",
36
+ " |",
37
+ "| |"]), '?')
39
38
 
40
39
  def test_unknown_char(self):
41
- self.assertEqual('?', number([" - ",
42
- " _|",
43
- " X|",
44
- " "]))
40
+ self.assertEqual(number([" - ",
41
+ " _|",
42
+ " X|",
43
+ " "]), '?')
45
44
 
46
45
  def test_too_short_row(self):
47
46
  self.assertRaises(ValueError, number, [" ",
@@ -55,49 +54,64 @@ class OcrTest(unittest.TestCase):
55
54
  " X|"])
56
55
 
57
56
  def test_grid0(self):
58
- self.assertEqual([" _ ",
59
- "| |",
60
- "|_|",
61
- " "], grid('0'))
57
+ self.assertEqual(grid('0'), [" _ ",
58
+ "| |",
59
+ "|_|",
60
+ " "])
62
61
 
63
62
  def test_grid1(self):
64
- self.assertEqual([" ",
65
- " |",
66
- " |",
67
- " "], grid('1'))
63
+ self.assertEqual(grid('1'), [" ",
64
+ " |",
65
+ " |",
66
+ " "])
68
67
 
69
68
  def test_0010110(self):
70
- self.assertEqual('0010110', number([" _ _ _ _ ",
71
- "| || | || | | || |",
72
- "|_||_| ||_| | ||_|",
73
- " "]))
69
+ self.assertEqual(
70
+ number([
71
+ " _ _ _ _ ",
72
+ "| || | || | | || |",
73
+ "|_||_| ||_| | ||_|",
74
+ " "
75
+ ]), '0010110')
74
76
 
75
77
  def test_3186547290(self):
76
78
  digits = '3186547290'
77
- self.assertEqual(digits, number([" _ _ _ _ _ _ _ _ ",
78
- " _| ||_||_ |_ |_| | _||_|| |",
79
- " _| ||_||_| _| | ||_ _||_|",
80
- " "]))
79
+ self.assertEqual(
80
+ number([
81
+ " _ _ _ _ _ _ _ _ ",
82
+ " _| ||_||_ |_ |_| | _||_|| |",
83
+ " _| ||_||_| _| | ||_ _||_|",
84
+ " "
85
+ ]), digits)
81
86
 
82
87
  def test_Lost(self):
83
88
  digits = '4815162342'
84
- self.assertEqual(digits, number([" _ _ _ _ _ _ ",
85
- "|_||_| ||_ ||_ _| _||_| _|",
86
- " ||_| | _| ||_||_ _| ||_ ",
87
- " "]))
89
+ self.assertEqual(
90
+ number([
91
+ " _ _ _ _ _ _ ",
92
+ "|_||_| ||_ ||_ _| _||_| _|",
93
+ " ||_| | _| ||_||_ _| ||_ ",
94
+ " "
95
+ ]), digits)
88
96
 
89
97
  def test_garble_middle(self):
90
- self.assertEqual('12?45', number([" _ _ _ ",
91
- " | _| ||_||_ ",
92
- " ||_ _| | _|",
93
- " "]))
98
+ self.assertEqual(
99
+ number([
100
+ " _ _ _ ",
101
+ " | _| ||_||_ ",
102
+ " ||_ _| | _|",
103
+ " "
104
+ ]), '12?45')
94
105
 
95
106
  def test_grid3186547290(self):
96
107
  digits = '3186547290'
97
- self.assertEqual([" _ _ _ _ _ _ _ _ ",
98
- " _| ||_||_ |_ |_| | _||_|| |",
99
- " _| ||_||_| _| | ||_ _||_|",
100
- " "], grid(digits))
108
+ self.assertEqual(
109
+ grid(digits), [
110
+ " _ _ _ _ _ _ _ _ ",
111
+ " _| ||_||_ |_ |_| | _||_|| |",
112
+ " _| ||_||_| _| | ||_ _||_|",
113
+ " "
114
+ ])
101
115
 
102
116
  def test_invalid_grid(self):
103
117
  self.assertRaises(ValueError, grid, '123a')
@@ -11,22 +11,22 @@ from octal import parse_octal
11
11
 
12
12
  class OctalTest(unittest.TestCase):
13
13
  def test_octal_1_is_decimal_1(self):
14
- self.assertEqual(1, parse_octal("1"))
14
+ self.assertEqual(parse_octal("1"), 1)
15
15
 
16
16
  def test_octal_10_is_decimal_8(self):
17
- self.assertEqual(8, parse_octal("10"))
17
+ self.assertEqual(parse_octal("10"), 8)
18
18
 
19
19
  def test_octal_17_is_decimal_15(self):
20
- self.assertEqual(15, parse_octal("17"))
20
+ self.assertEqual(parse_octal("17"), 15)
21
21
 
22
22
  def test_octal_130_is_decimal_88(self):
23
- self.assertEqual(88, parse_octal("130"))
23
+ self.assertEqual(parse_octal("130"), 88)
24
24
 
25
25
  def test_octal_2047_is_decimal_1063(self):
26
- self.assertEqual(1063, parse_octal("2047"))
26
+ self.assertEqual(parse_octal("2047"), 1063)
27
27
 
28
28
  def test_octal_1234567_is_decimal_342391(self):
29
- self.assertEqual(342391, parse_octal("1234567"))
29
+ self.assertEqual(parse_octal("1234567"), 342391)
30
30
 
31
31
  def test_8_is_seen_as_invalid(self):
32
32
  self.assertRaises(ValueError, parse_octal, "8")
@@ -38,7 +38,7 @@ class OctalTest(unittest.TestCase):
38
38
  self.assertRaises(ValueError, parse_octal, "6789")
39
39
 
40
40
  def test_valid_octal_formatted_string_011_is_decimal_9(self):
41
- self.assertEqual(9, parse_octal("011"))
41
+ self.assertEqual(parse_octal("011"), 9)
42
42
 
43
43
 
44
44
  if __name__ == '__main__':
@@ -19,28 +19,28 @@ from palindrome_products import smallest_palindrome, largest_palindrome
19
19
  class PalindromesTests(unittest.TestCase):
20
20
  def test_largest_palindrome_from_single_digit_factors(self):
21
21
  value, factors = largest_palindrome(max_factor=9)
22
- self.assertEqual(9, value)
22
+ self.assertEqual(value, 9)
23
23
  self.assertIn(set(factors), [{1, 9}, {3, 3}])
24
24
 
25
25
  def test_largest_palindrome_from_double_digit_factors(self):
26
26
  value, factors = largest_palindrome(max_factor=99, min_factor=10)
27
- self.assertEqual(9009, value)
28
- self.assertEqual({91, 99}, set(factors))
27
+ self.assertEqual(value, 9009)
28
+ self.assertEqual(set(factors), {91, 99})
29
29
 
30
30
  def test_smallest_palindrome_from_double_digit_factors(self):
31
31
  value, factors = smallest_palindrome(max_factor=99, min_factor=10)
32
- self.assertEqual(121, value)
33
- self.assertEqual({11}, set(factors))
32
+ self.assertEqual(value, 121)
33
+ self.assertEqual(set(factors), {11})
34
34
 
35
35
  def test_largest_palindrome_from_triple_digit_factors(self):
36
36
  value, factors = largest_palindrome(max_factor=999, min_factor=100)
37
- self.assertEqual(906609, value)
38
- self.assertEqual({913, 993}, set(factors))
37
+ self.assertEqual(value, 906609)
38
+ self.assertEqual(set(factors), {913, 993})
39
39
 
40
40
  def test_smallest_palindrome_from_triple_digit_factors(self):
41
41
  value, factors = smallest_palindrome(max_factor=999, min_factor=100)
42
- self.assertEqual(10201, value)
43
- self.assertEqual({101, 101}, set(factors))
42
+ self.assertEqual(value, 10201)
43
+ self.assertEqual(set(factors), {101, 101})
44
44
 
45
45
 
46
46
  if __name__ == '__main__':
@@ -6,32 +6,32 @@ from pascals_triangle import triangle, row, is_triangle
6
6
  class PascalsTriangleTest(unittest.TestCase):
7
7
  def test_triangle1(self):
8
8
  ans = ['1', '1 1', '1 2 1', '1 3 3 1', '1 4 6 4 1']
9
- self.assertEqual(ans, triangle(4))
9
+ self.assertEqual(triangle(4), ans)
10
10
 
11
11
  def test_triangle2(self):
12
12
  ans = ['1', '1 1', '1 2 1', '1 3 3 1', '1 4 6 4 1', '1 5 10 10 5 1',
13
13
  '1 6 15 20 15 6 1']
14
- self.assertEqual(ans, triangle(6))
14
+ self.assertEqual(triangle(6), ans)
15
15
 
16
16
  def test_is_triangle_true(self):
17
17
  inp = ['1', '1 1', '1 2 1', '1 3 3 1', '1 4 6 4 1', '1 5 10 10 5 1']
18
- self.assertEqual(True, is_triangle(inp))
18
+ self.assertTrue(is_triangle(inp))
19
19
 
20
20
  def test_is_triangle_false(self):
21
21
  inp = ['1', '1 1', '1 2 1', '1 4 4 1']
22
- self.assertEqual(False, is_triangle(inp))
22
+ self.assertFalse(is_triangle(inp))
23
23
 
24
24
  def test_row1(self):
25
25
  ans = '1'
26
- self.assertEqual(ans, row(0))
26
+ self.assertEqual(row(0), ans)
27
27
 
28
28
  def test_row2(self):
29
29
  ans = '1 2 1'
30
- self.assertEqual(ans, row(2))
30
+ self.assertEqual(row(2), ans)
31
31
 
32
32
  def test_row3(self):
33
33
  ans = '1 7 21 35 35 21 7 1'
34
- self.assertEqual(ans, row(7))
34
+ self.assertEqual(row(7), ans)
35
35
 
36
36
 
37
37
  if __name__ == '__main__':