trackler 2.2.1.87 → 2.2.1.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/bash/.travis.yml +6 -2
  4. data/tracks/bash/bin/validate-exercises +37 -0
  5. data/tracks/bash/exercises/reverse-string/example.sh +1 -1
  6. data/tracks/bash/exercises/reverse-string/reverse_string_test.sh +7 -7
  7. data/tracks/csharp/exercises/bracket-push/BracketPush.cs +2 -15
  8. data/tracks/elisp/.travis.yml +2 -2
  9. data/tracks/elisp/config.json +8 -0
  10. data/tracks/elisp/exercises/pangram/README.md +16 -0
  11. data/tracks/elisp/exercises/pangram/example.el +17 -0
  12. data/tracks/elisp/exercises/pangram/pangram-test.el +41 -0
  13. data/tracks/elisp/exercises/pangram/pangram.el +9 -0
  14. data/tracks/gnu-apl/config.json +6 -6
  15. data/tracks/java/exercises/phone-number/.meta/hints.md +58 -0
  16. data/tracks/java/exercises/phone-number/README.md +62 -0
  17. data/tracks/java/exercises/rna-transcription/.meta/version +1 -1
  18. data/tracks/java/exercises/rna-transcription/src/test/java/RnaTranscriptionTest.java +0 -29
  19. data/tracks/python/.travis.yml +2 -2
  20. data/tracks/python/exercises/complex-numbers/.meta/hints.md +3 -0
  21. data/tracks/python/exercises/complex-numbers/README.md +4 -0
  22. data/tracks/python/exercises/complex-numbers/complex_numbers.py +5 -5
  23. data/tracks/python/exercises/complex-numbers/complex_numbers_test.py +28 -32
  24. data/tracks/python/exercises/complex-numbers/example.py +8 -5
  25. data/tracks/python/exercises/difference-of-squares/difference_of_squares.py +3 -3
  26. data/tracks/python/exercises/difference-of-squares/example.py +6 -6
  27. data/tracks/python/exercises/palindrome-products/example.py +112 -11
  28. data/tracks/python/exercises/palindrome-products/palindrome_products_test.py +55 -14
  29. data/tracks/python/exercises/pangram/pangram_test.py +9 -6
  30. data/tracks/python/exercises/phone-number/phone_number_test.py +2 -2
  31. data/tracks/python/exercises/secret-handshake/example.py +14 -47
  32. data/tracks/python/exercises/secret-handshake/secret_handshake.py +2 -2
  33. data/tracks/python/exercises/secret-handshake/secret_handshake_test.py +56 -25
  34. data/tracks/python/exercises/transpose/example.py +5 -5
  35. data/tracks/python/exercises/transpose/transpose_test.py +37 -74
  36. data/tracks/python/exercises/word-search/example.py +1 -1
  37. data/tracks/python/exercises/word-search/word_search_test.py +63 -63
  38. metadata +9 -2
@@ -3,12 +3,16 @@ import unittest
3
3
  from pangram import is_pangram
4
4
 
5
5
 
6
- # test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
6
+ # Tests adapted from `problem-specifications//canonical-data.json` @ v1.3.0
7
7
 
8
8
  class PangramTests(unittest.TestCase):
9
+
9
10
  def test_sentence_empty(self):
10
11
  self.assertIs(is_pangram(''), False)
11
12
 
13
+ def test_recognizes_a_perfect_lower_case_pangram(self):
14
+ self.assertIs(is_pangram('abcdefghijklmnopqrstuvwxyz'), True)
15
+
12
16
  def test_pangram_with_only_lower_case(self):
13
17
  self.assertIs(
14
18
  is_pangram('the quick brown fox jumps over the lazy dog'),
@@ -20,10 +24,9 @@ class PangramTests(unittest.TestCase):
20
24
  'jeopardize five gunboats'),
21
25
  False)
22
26
 
23
- def test_another_missing_character_x(self):
24
- self.assertIs(
25
- is_pangram('the quick brown fish jumps over the lazy dog'),
26
- False)
27
+ def test_another_missing_character(self):
28
+ self.assertIs(is_pangram('five boxing wizards jump quickly at it'),
29
+ False)
27
30
 
28
31
  def test_pangram_with_underscores(self):
29
32
  self.assertIs(
@@ -47,7 +50,7 @@ class PangramTests(unittest.TestCase):
47
50
 
48
51
  def test_upper_and_lower_case_versions_of_the_same_character(self):
49
52
  self.assertIs(
50
- is_pangram('the quick brown fox jumped over the lazy FOX'),
53
+ is_pangram('the quick brown fox jumped over the lazy FX'),
51
54
  False)
52
55
 
53
56
 
@@ -46,11 +46,11 @@ class PhoneTest(unittest.TestCase):
46
46
  with self.assertRaisesWithMessage(ValueError):
47
47
  Phone("123-@:!-7890")
48
48
 
49
- def test_invalid_area_code(self):
49
+ def test_invalid_when_area_code_does_start_with_1(self):
50
50
  with self.assertRaisesWithMessage(ValueError):
51
51
  Phone("(123) 456-7890")
52
52
 
53
- def test_invalid_exchange_code(self):
53
+ def test_invalid_when_exchange_code_does_start_with_1(self):
54
54
  with self.assertRaisesWithMessage(ValueError):
55
55
  Phone("(223) 056-7890")
56
56
 
@@ -1,50 +1,17 @@
1
1
  gestures = ['wink', 'double blink', 'close your eyes', 'jump']
2
2
 
3
3
 
4
- def handshake(s):
5
- s = list(sanitize(s))
6
- s.reverse()
7
- seq = []
8
- lim = len(s) if len(s) <= len(gestures) else len(gestures)
9
- for i1 in range(lim):
10
- if s[i1] == '1':
11
- seq.append(gestures[i1])
12
- if len(s) == 5:
13
- seq.reverse()
14
- return seq
15
-
16
-
17
- def code(seq):
18
- if not seq or set(seq) - set(gestures):
19
- return '0'
20
- s = find_subseq(seq)
21
- if not s:
22
- s = ['1'] + find_subseq(reversed(seq))
23
- return "".join(s)
24
-
25
-
26
- def sanitize(s):
27
- if not(isinstance(s, int) or isinstance(s, str)):
28
- raise TypeError('Unknown type')
29
- if isinstance(s, int):
30
- if s < 0:
31
- return ""
32
- s = bin(s)[2:]
33
- elif set(s) - set(['0', '1']):
34
- return ""
35
- if len(s) > 5:
36
- raise ValueError('Binary string too long')
37
- return "0" * (len(gestures) - len(s)) + s
38
-
39
-
40
- def find_subseq(seq):
41
- idx = 0
42
- s = []
43
- for g in seq:
44
- if g not in gestures[idx:]:
45
- return []
46
- newidx = gestures.index(g, idx) + 1
47
- s.extend(['0'] * (newidx - idx - 1) + ['1'])
48
- idx = newidx
49
- s.reverse()
50
- return s
4
+ def handshake(code):
5
+ actions = [gestures[i] for i in range(len(gestures))
6
+ if (code >> i) % 2 == 1]
7
+ return actions if code < 16 else list(reversed(actions))
8
+
9
+
10
+ def secret_code(actions):
11
+ actions = [a for a in actions if a in gestures]
12
+ result = sum(1 << i for i, action in enumerate(gestures)
13
+ if action in actions)
14
+ if len(actions) > 1 and (gestures.index(actions[0]) >
15
+ gestures.index(actions[1])):
16
+ result += 16
17
+ return result
@@ -1,6 +1,6 @@
1
- def handshake(number):
1
+ def handshake(code):
2
2
  pass
3
3
 
4
4
 
5
- def code(secret_code):
5
+ def secret_code(actions):
6
6
  pass
@@ -1,49 +1,80 @@
1
1
  import unittest
2
2
 
3
- from secret_handshake import handshake, code
3
+ from secret_handshake import handshake, secret_code
4
4
 
5
5
 
6
+ # Tests adapted from `problem-specifications//canonical-data.json` @ v1.1.0
7
+
6
8
  class HandshakeTest(unittest.TestCase):
7
- def test_shake_int(self):
8
- self.assertEqual(handshake(9), ['wink', 'jump'])
9
+ def test_wink_for_1(self):
10
+ self.assertEqual(handshake(1), ['wink'])
11
+
12
+ def test_double_blink_for_10(self):
13
+ self.assertEqual(handshake(2), ['double blink'])
14
+
15
+ def test_close_your_eyes_for_100(self):
16
+ self.assertEqual(handshake(4), ['close your eyes'])
17
+
18
+ def test_jump_for_1000(self):
19
+ self.assertEqual(handshake(8), ['jump'])
20
+
21
+ def test_combine_two_actions(self):
22
+ self.assertEqual(handshake(3), ['wink', 'double blink'])
23
+
24
+ def test_reverse_two_actions(self):
25
+ self.assertEqual(handshake(19), ['double blink', 'wink'])
26
+
27
+ def test_reversing_one_action_gives_the_same_action(self):
28
+ self.assertEqual(handshake(24), ['jump'])
9
29
 
10
- def test_shake_bin1(self):
11
- self.assertEqual(
12
- handshake('10110'), ['close your eyes', 'double blink'])
30
+ def test_reversing_no_actions_still_gives_no_actions(self):
31
+ self.assertEqual(handshake(16), [])
13
32
 
14
- def test_shake_bin2(self):
15
- self.assertEqual(handshake('101'), ['wink', 'close your eyes'])
33
+ def test_all_possible_actions(self):
34
+ self.assertEqual(handshake(15), ['wink',
35
+ 'double blink',
36
+ 'close your eyes',
37
+ 'jump'])
16
38
 
17
- def test_shake_negative_int(self):
18
- self.assertEqual(handshake(-9), [])
39
+ def test_reverse_all_possible_actions(self):
40
+ self.assertEqual(handshake(31), ['jump',
41
+ 'close your eyes',
42
+ 'double blink',
43
+ 'wink'])
19
44
 
20
- def test_shake_bin_invalid(self):
21
- self.assertEqual(handshake('121'), [])
45
+ def test_do_nothing_for_zero(self):
46
+ self.assertEqual(handshake(0), [])
22
47
 
23
- def test_unknown_action(self):
24
- self.assertEqual(code(['wink', 'sneeze']), '0')
48
+ # Track-specific tests
25
49
 
50
+ @unittest.skip('extra-credit')
26
51
  def test_code1(self):
27
- self.assertEqual(code(['close your eyes', 'jump']), '1100')
52
+ self.assertEqual(secret_code(['close your eyes', 'jump']), 12)
28
53
 
54
+ @unittest.skip('extra-credit')
29
55
  def test_code2(self):
30
- self.assertEqual(code(['wink', 'double blink']), '11')
56
+ self.assertEqual(secret_code(['wink', 'double blink']), 3)
31
57
 
58
+ @unittest.skip('extra-credit')
32
59
  def test_code3(self):
33
- self.assertEqual(code(['jump', 'double blink']), '11010')
60
+ self.assertEqual(secret_code(['jump', 'double blink']), 26)
34
61
 
35
- def test_composition1(self):
36
- self.assertEqual(code(handshake(27)), '11011')
62
+ @unittest.skip('extra-credit')
63
+ def test_reversible1(self):
64
+ self.assertEqual(secret_code(handshake(27)), 27)
37
65
 
38
- def test_composition2(self):
39
- self.assertEqual(code(handshake(1)), '1')
66
+ @unittest.skip('extra-credit')
67
+ def test_reversible2(self):
68
+ self.assertEqual(secret_code(handshake(1)), 1)
40
69
 
41
- def test_composition3(self):
42
- self.assertEqual(code(handshake('111')), '111')
70
+ @unittest.skip('extra-credit')
71
+ def test_reversible3(self):
72
+ self.assertEqual(secret_code(handshake(7)), 7)
43
73
 
44
- def test_composition4(self):
74
+ @unittest.skip('extra-credit')
75
+ def test_reversible4(self):
45
76
  inp = ['wink', 'double blink', 'jump']
46
- self.assertEqual(handshake(code(inp)), inp)
77
+ self.assertEqual(handshake(secret_code(inp)), inp)
47
78
 
48
79
 
49
80
  if __name__ == '__main__':
@@ -1,6 +1,6 @@
1
1
  def transpose(input_lines):
2
- lines = input_lines.split("\n")
3
- zipped = map(list,
4
- [line.ljust(len(max(lines, key=len)))
5
- for line in lines])
6
- return "\n".join("".join(line) for line in zip(*zipped)).strip()
2
+ lines = [line.replace(' ', '_') for line in input_lines.splitlines()]
3
+ lines = [line.ljust(len(max(lines, key=len))) for line in lines]
4
+ lines = [''.join(line) for line in zip(*lines)]
5
+ lines = [line.rstrip().replace('_', ' ') for line in lines]
6
+ return '\n'.join(lines)
@@ -2,7 +2,7 @@ import unittest
2
2
  from transpose import transpose
3
3
 
4
4
 
5
- # Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.0
5
+ # Tests adapted from `problem-specifications//canonical-data.json` @ v1.1.0
6
6
 
7
7
  class TransposeTests(unittest.TestCase):
8
8
  def test_empty_string(self):
@@ -14,15 +14,25 @@ class TransposeTests(unittest.TestCase):
14
14
  )
15
15
 
16
16
  def test_two_characters_in_a_row(self):
17
+ input_line = "A1"
18
+ expected = [
19
+ "A",
20
+ "1"
21
+ ]
17
22
  self.assertEqual(
18
- transpose("A1"),
19
- "\n".join(["A", "1"])
23
+ transpose(input_line),
24
+ "\n".join(expected)
20
25
  )
21
26
 
22
27
  def test_two_characters_in_a_column(self):
28
+ input_line = [
29
+ "A",
30
+ "1"
31
+ ]
32
+ expected = "A1"
23
33
  self.assertEqual(
24
- transpose("\n".join(["A", "1"])),
25
- "A1"
34
+ transpose("\n".join(input_line)),
35
+ expected
26
36
  )
27
37
 
28
38
  def test_simple(self):
@@ -35,7 +45,6 @@ class TransposeTests(unittest.TestCase):
35
45
  "B2",
36
46
  "C3"
37
47
  ]
38
-
39
48
  self.assertEqual(
40
49
  transpose("\n".join(input_line)),
41
50
  "\n".join(expected)
@@ -182,77 +191,31 @@ class TransposeTests(unittest.TestCase):
182
191
  "\n".join(expected)
183
192
  )
184
193
 
185
- def test_many_lines(self):
194
+ def test_mixed_line_length(self):
186
195
  input_line = [
187
- "Chor. Two households, both alike in dignity,",
188
- "In fair Verona, where we lay our scene,",
189
- "From ancient grudge break to new mutiny,",
190
- "Where civil blood makes civil hands unclean.",
191
- "From forth the fatal loins of these two foes",
192
- "A pair of star-cross'd lovers take their life;",
193
- "Whose misadventur'd piteous overthrows",
194
- "Doth with their death bury their parents' strife.",
195
- "The fearful passage of their death-mark'd love,",
196
- "And the continuance of their parents' rage,",
197
- "Which, but their children's end, naught could remove,",
198
- "Is now the two hours' traffic of our stage;",
199
- "The which if you with patient ears attend,",
200
- "What here shall miss, our toil shall strive to mend."
196
+ "The longest line.",
197
+ "A long line.",
198
+ "A longer line.",
199
+ "A line."
201
200
  ]
202
201
  expected = [
203
- "CIFWFAWDTAWITW",
204
- "hnrhr hohnhshh",
205
- "o oeopotedi ea",
206
- "rfmrmash cn t",
207
- ".a e ie fthow ",
208
- " ia fr weh,whh",
209
- "Trnco miae ie",
210
- "w ciroitr btcr",
211
- "oVivtfshfcuhhe",
212
- " eeih a uote ",
213
- "hrnl sdtln is",
214
- "oot ttvh tttfh",
215
- "un bhaeepihw a",
216
- "saglernianeoyl",
217
- "e,ro -trsui ol",
218
- "h uofcu sarhu ",
219
- "owddarrdan o m",
220
- "lhg to'egccuwi",
221
- "deemasdaeehris",
222
- "sr als t ists",
223
- ",ebk 'phool'h,",
224
- " reldi ffd ",
225
- "bweso tb rtpo",
226
- "oea ileutterau",
227
- "t kcnoorhhnatr",
228
- "hl isvuyee'fi ",
229
- " atv es iisfet",
230
- "ayoior trr ino",
231
- "l lfsoh ecti",
232
- "ion vedpn l",
233
- "kuehtteieadoe ",
234
- "erwaharrar,fas",
235
- " nekt te rh",
236
- "ismdsehphnnosa",
237
- "ncuse ra-tau l",
238
- " et tormsural",
239
- "dniuthwea'g t ",
240
- "iennwesnr hsts",
241
- "g,ycoi tkrttet",
242
- "n ,l r s'a anr",
243
- "i ef 'dgcgdi",
244
- "t aol eoe,v",
245
- "y nei sl,u; e",
246
- ", .sf to l ",
247
- " e rv d t",
248
- " ; ie o",
249
- " f, r ",
250
- " e e m",
251
- " . m e",
252
- " o n",
253
- " v d",
254
- " e .",
255
- " ,"
202
+ "TAAA",
203
+ "h ",
204
+ "elll",
205
+ " ooi",
206
+ "lnnn",
207
+ "ogge",
208
+ "n e.",
209
+ "glr",
210
+ "ei ",
211
+ "snl",
212
+ "tei",
213
+ " .n",
214
+ "l e",
215
+ "i .",
216
+ "n",
217
+ "e",
218
+ "."
256
219
  ]
257
220
  self.assertEqual(
258
221
  transpose("\n".join(input_line)),
@@ -28,7 +28,7 @@ DIRECTIONS = (Point(1, 0), Point(1, -1), Point(1, 1), Point(-1, -1),
28
28
 
29
29
  class WordSearch(object):
30
30
  def __init__(self, puzzle):
31
- self.rows = puzzle.split()
31
+ self.rows = puzzle
32
32
  self.width = len(self.rows[0])
33
33
  self.height = len(self.rows)
34
34
 
@@ -8,119 +8,119 @@ from word_search import WordSearch, Point
8
8
  class WordSearchTests(unittest.TestCase):
9
9
 
10
10
  def test_initial_game_grid(self):
11
- puzzle = 'jefblpepre'
11
+ puzzle = ['jefblpepre']
12
12
  searchAnswer = WordSearch(puzzle).search('clojure')
13
13
  self.assertIsNone(searchAnswer)
14
14
 
15
15
  def test_left_to_right_word(self):
16
- puzzle = 'clojurermt'
16
+ puzzle = ['clojurermt']
17
17
  searchAnswer = WordSearch(puzzle).search('clojure')
18
18
  self.assertEqual(searchAnswer, (Point(0, 0), Point(6, 0)))
19
19
 
20
20
  def test_left_to_right_word_different_position(self):
21
- puzzle = 'mtclojurer'
21
+ puzzle = ['mtclojurer']
22
22
  searchAnswer = WordSearch(puzzle).search('clojure')
23
23
  self.assertEqual(searchAnswer, (Point(2, 0), Point(8, 0)))
24
24
 
25
25
  def test_different_left_to_right_word(self):
26
- puzzle = 'coffeelplx'
26
+ puzzle = ['coffeelplx']
27
27
  searchAnswer = WordSearch(puzzle).search('coffee')
28
28
  self.assertEqual(searchAnswer, (Point(0, 0), Point(5, 0)))
29
29
 
30
30
  def test_different_left_to_right_word_different_position(self):
31
- puzzle = 'xcoffeezlp'
31
+ puzzle = ['xcoffeezlp']
32
32
  searchAnswer = WordSearch(puzzle).search('coffee')
33
33
  self.assertEqual(searchAnswer, (Point(1, 0), Point(6, 0)))
34
34
 
35
35
  def test_left_to_right_word_two_lines(self):
36
- puzzle = ('jefblpepre\n'
37
- 'tclojurerm\n')
36
+ puzzle = ['jefblpepre',
37
+ 'tclojurerm']
38
38
  searchAnswer = WordSearch(puzzle).search('clojure')
39
39
  self.assertEqual(searchAnswer, (Point(1, 1), Point(7, 1)))
40
40
 
41
41
  def test_left_to_right_word_three_lines(self):
42
- puzzle = ('camdcimgtc\n'
43
- 'jefblpepre\n'
44
- 'clojurermt\n')
42
+ puzzle = ['camdcimgtc',
43
+ 'jefblpepre',
44
+ 'clojurermt']
45
45
  searchAnswer = WordSearch(puzzle).search('clojure')
46
46
  self.assertEqual(searchAnswer, (Point(0, 2), Point(6, 2)))
47
47
 
48
48
  def test_left_to_right_word_ten_lines(self):
49
- puzzle = ('jefblpepre\n'
50
- 'camdcimgtc\n'
51
- 'oivokprjsm\n'
52
- 'pbwasqroua\n'
53
- 'rixilelhrs\n'
54
- 'wolcqlirpc\n'
55
- 'screeaumgr\n'
56
- 'alxhpburyi\n'
57
- 'jalaycalmp\n'
58
- 'clojurermt\n')
49
+ puzzle = ['jefblpepre',
50
+ 'camdcimgtc',
51
+ 'oivokprjsm',
52
+ 'pbwasqroua',
53
+ 'rixilelhrs',
54
+ 'wolcqlirpc',
55
+ 'screeaumgr',
56
+ 'alxhpburyi',
57
+ 'jalaycalmp',
58
+ 'clojurermt']
59
59
  searchAnswer = WordSearch(puzzle).search('clojure')
60
60
  self.assertEqual(searchAnswer, (Point(0, 9), Point(6, 9)))
61
61
 
62
62
  def test_left_to_right_word_ten_lines_different_position(self):
63
- puzzle = ('jefblpepre\n'
64
- 'camdcimgtc\n'
65
- 'oivokprjsm\n'
66
- 'pbwasqroua\n'
67
- 'rixilelhrs\n'
68
- 'wolcqlirpc\n'
69
- 'screeaumgr\n'
70
- 'alxhpburyi\n'
71
- 'clojurermt\n'
72
- 'jalaycalmp\n')
63
+ puzzle = ['jefblpepre',
64
+ 'camdcimgtc',
65
+ 'oivokprjsm',
66
+ 'pbwasqroua',
67
+ 'rixilelhrs',
68
+ 'wolcqlirpc',
69
+ 'screeaumgr',
70
+ 'alxhpburyi',
71
+ 'clojurermt',
72
+ 'jalaycalmp']
73
73
  searchAnswer = WordSearch(puzzle).search('clojure')
74
74
  self.assertEqual(searchAnswer, (Point(0, 8), Point(6, 8)))
75
75
 
76
76
  def test_different_left_to_right_word_ten_lines(self):
77
- puzzle = ('jefblpepre\n'
78
- 'camdcimgtc\n'
79
- 'oivokprjsm\n'
80
- 'pbwasqroua\n'
81
- 'rixilelhrs\n'
82
- 'wolcqlirpc\n'
83
- 'fortranftw\n'
84
- 'alxhpburyi\n'
85
- 'clojurermt\n'
86
- 'jalaycalmp\n')
77
+ puzzle = ['jefblpepre',
78
+ 'camdcimgtc',
79
+ 'oivokprjsm',
80
+ 'pbwasqroua',
81
+ 'rixilelhrs',
82
+ 'wolcqlirpc',
83
+ 'fortranftw',
84
+ 'alxhpburyi',
85
+ 'clojurermt',
86
+ 'jalaycalmp']
87
87
  searchAnswer = WordSearch(puzzle).search('fortran')
88
88
  self.assertEqual(searchAnswer, (Point(0, 6), Point(6, 6)))
89
89
 
90
90
  def test_multiple_words(self):
91
- puzzle = ('jefblpepre\n'
92
- 'camdcimgtc\n'
93
- 'oivokprjsm\n'
94
- 'pbwasqroua\n'
95
- 'rixilelhrs\n'
96
- 'wolcqlirpc\n'
97
- 'fortranftw\n'
98
- 'alxhpburyi\n'
99
- 'jalaycalmp\n'
100
- 'clojurermt\n')
91
+ puzzle = ['jefblpepre',
92
+ 'camdcimgtc',
93
+ 'oivokprjsm',
94
+ 'pbwasqroua',
95
+ 'rixilelhrs',
96
+ 'wolcqlirpc',
97
+ 'fortranftw',
98
+ 'alxhpburyi',
99
+ 'jalaycalmp',
100
+ 'clojurermt']
101
101
  searchAnswer = WordSearch(puzzle).search('fortran')
102
102
  self.assertEqual(searchAnswer, (Point(0, 6), Point(6, 6)))
103
103
  searchAnswer = WordSearch(puzzle).search('clojure')
104
104
  self.assertEqual(searchAnswer, (Point(0, 9), Point(6, 9)))
105
105
 
106
106
  def test_single_word_right_to_left(self):
107
- puzzle = 'rixilelhrs'
107
+ puzzle = ['rixilelhrs']
108
108
  searchAnswer = WordSearch(puzzle).search('elixir')
109
109
  self.assertEqual(searchAnswer, (Point(5, 0), Point(0, 0)))
110
110
 
111
111
  @classmethod
112
- def setUpClass(self):
113
- puzzle = ('jefblpepre\n'
114
- 'camdcimgtc\n'
115
- 'oivokprjsm\n'
116
- 'pbwasqroua\n'
117
- 'rixilelhrs\n'
118
- 'wolcqlirpc\n'
119
- 'screeaumgr\n'
120
- 'alxhpburyi\n'
121
- 'jalaycalmp\n'
122
- 'clojurermt')
123
- self.example = WordSearch(puzzle)
112
+ def setUpClass(cls):
113
+ puzzle = ['jefblpepre',
114
+ 'camdcimgtc',
115
+ 'oivokprjsm',
116
+ 'pbwasqroua',
117
+ 'rixilelhrs',
118
+ 'wolcqlirpc',
119
+ 'screeaumgr',
120
+ 'alxhpburyi',
121
+ 'jalaycalmp',
122
+ 'clojurermt']
123
+ cls.example = WordSearch(puzzle)
124
124
 
125
125
  def test_horizontal_words_different_directions(self):
126
126
  self.assertEqual(