trackler 2.2.1.48 → 2.2.1.49
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/grains/canonical-data.json +1 -1
- data/problem-specifications/exercises/isbn-verifier/description.md +1 -1
- data/tracks/dart/exercises/anagram/pubspec.lock +10 -10
- data/tracks/dart/exercises/bob/pubspec.lock +4 -4
- data/tracks/dart/exercises/difference-of-squares/pubspec.lock +4 -4
- data/tracks/dart/exercises/gigasecond/pubspec.lock +4 -4
- data/tracks/dart/exercises/hamming/pubspec.lock +4 -4
- data/tracks/dart/exercises/hello-world/pubspec.lock +4 -4
- data/tracks/dart/exercises/leap/pubspec.lock +4 -4
- data/tracks/dart/exercises/phone-number/pubspec.lock +4 -4
- data/tracks/dart/exercises/raindrops/pubspec.lock +17 -5
- data/tracks/dart/exercises/rna-transcription/pubspec.lock +4 -4
- data/tracks/dart/exercises/word-count/pubspec.lock +4 -4
- data/tracks/dart/pubspec.lock +3 -3
- data/tracks/fsharp/exercises/largest-series-product/Example.fs +18 -4
- data/tracks/fsharp/exercises/largest-series-product/LargestSeriesProduct.fs +1 -1
- data/tracks/fsharp/exercises/largest-series-product/LargestSeriesProductTest.fs +80 -36
- data/tracks/fsharp/generators/Exercise.fs +1 -1
- data/tracks/fsharp/generators/Generators.fs +10 -0
- data/tracks/gnu-apl/config.json +14 -0
- data/tracks/gnu-apl/exercises/difference-of-squares/README.md +19 -0
- data/tracks/gnu-apl/exercises/difference-of-squares/difference-of-squares-example.apl +13 -0
- data/tracks/gnu-apl/exercises/difference-of-squares/difference-of-squares.tc +38 -0
- data/tracks/gnu-apl/exercises/pangram/README.md +15 -0
- data/tracks/gnu-apl/exercises/pangram/pangram-example.apl +14 -0
- data/tracks/gnu-apl/exercises/pangram/pangram.tc +40 -0
- data/tracks/gnu-apl/exercises/raindrops/raindrops.tc +1 -1
- data/tracks/java/exercises/bracket-push/.meta/version +1 -0
- data/tracks/java/exercises/complex-numbers/.meta/version +1 -0
- data/tracks/java/exercises/ocr-numbers/.meta/version +1 -0
- data/tracks/java/exercises/queen-attack/.meta/version +1 -0
- data/tracks/java/exercises/rectangles/.meta/version +1 -0
- data/tracks/java/exercises/robot-simulator/.meta/version +1 -0
- data/tracks/java/exercises/secret-handshake/.meta/version +1 -0
- data/tracks/java/exercises/sublist/.meta/version +1 -0
- data/tracks/perl6/exercises/accumulate/accumulate.t +1 -6
- data/tracks/perl6/exercises/all-your-base/all-your-base.t +14 -19
- data/tracks/perl6/exercises/allergies/Allergies.pm6 +1 -1
- data/tracks/perl6/exercises/allergies/Example.pm6 +1 -1
- data/tracks/perl6/exercises/allergies/allergies.t +25 -29
- data/tracks/perl6/exercises/allergies/example.yaml +11 -10
- data/tracks/perl6/exercises/anagram/anagram.t +14 -19
- data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +14 -19
- data/tracks/perl6/exercises/bob/bob.t +16 -23
- data/tracks/perl6/exercises/bob/example.yaml +1 -3
- data/tracks/perl6/exercises/clock/clock.t +14 -19
- data/tracks/perl6/exercises/flatten-array/flatten-array.t +14 -19
- data/tracks/perl6/exercises/grade-school/grade-school.t +1 -6
- data/tracks/perl6/exercises/grains/grains.t +15 -20
- data/tracks/perl6/exercises/hello-world/example.yaml +1 -3
- data/tracks/perl6/exercises/hello-world/hello-world.t +16 -23
- data/tracks/perl6/exercises/leap/leap.t +14 -19
- data/tracks/perl6/exercises/linked-list/example.yaml +59 -59
- data/tracks/perl6/exercises/linked-list/linked-list.t +59 -64
- data/tracks/perl6/exercises/luhn/luhn.t +14 -19
- data/tracks/perl6/exercises/phone-number/phone-number.t +14 -19
- data/tracks/perl6/exercises/raindrops/raindrops.t +14 -19
- data/tracks/perl6/exercises/rna-transcription/rna-transcription.t +14 -19
- data/tracks/perl6/exercises/robot-name/robot-name.t +1 -6
- data/tracks/perl6/exercises/scrabble-score/scrabble-score.t +14 -19
- data/tracks/perl6/exercises/space-age/space-age.t +14 -19
- data/tracks/perl6/exercises/word-count/word-count.t +14 -19
- data/tracks/perl6/exercises/wordy/wordy.t +14 -19
- data/tracks/perl6/templates/test.mustache +19 -25
- data/tracks/purescript/config.json +12 -0
- data/tracks/purescript/exercises/sum-of-multiples/README.md +15 -0
- data/tracks/purescript/exercises/sum-of-multiples/bower.json +26 -0
- data/tracks/purescript/exercises/sum-of-multiples/examples/src/SumOfMultiples.purs +16 -0
- data/tracks/purescript/exercises/sum-of-multiples/src/SumOfMultiples.purs +3 -0
- data/tracks/purescript/exercises/sum-of-multiples/test/Main.purs +63 -0
- data/tracks/python/README.md +5 -1
- data/tracks/python/config.json +52 -9
- data/tracks/python/exercises/allergies/allergies_test.py +7 -7
- data/tracks/python/exercises/allergies/example.py +1 -1
- data/tracks/python/exercises/binary-search/binary_search_test.py +8 -5
- data/tracks/python/exercises/binary/binary_test.py +8 -4
- data/tracks/python/exercises/book-store/example.py +1 -1
- data/tracks/python/exercises/clock/clock.py +3 -0
- data/tracks/python/exercises/clock/clock_test.py +16 -16
- data/tracks/python/exercises/clock/example.py +1 -1
- data/tracks/python/exercises/list-ops/example.py +10 -29
- data/tracks/python/exercises/list-ops/list_ops.py +8 -12
- data/tracks/python/exercises/list-ops/list_ops_test.py +55 -86
- data/tracks/python/exercises/meetup/meetup_test.py +2 -2
- data/tracks/python/exercises/minesweeper/minesweeper_test.py +6 -3
- data/tracks/python/exercises/ocr-numbers/ocr_numbers_test.py +11 -8
- data/tracks/python/exercises/pangram/pangram_test.py +25 -16
- data/tracks/python/exercises/point-mutations/point_mutations.py +1 -1
- data/tracks/python/exercises/pythagorean-triplet/pythagorean_triplet_test.py +2 -1
- data/tracks/python/exercises/saddle-points/saddle_points_test.py +2 -1
- data/tracks/python/exercises/simple-cipher/simple_cipher_test.py +4 -2
- data/tracks/python/exercises/triangle/triangle_test.py +10 -5
- data/tracks/python/exercises/wordy/wordy_test.py +8 -5
- data/tracks/python/exercises/zipper/README.md +43 -0
- data/tracks/python/exercises/zipper/example.py +41 -0
- data/tracks/python/exercises/zipper/zipper.py +28 -0
- data/tracks/python/exercises/zipper/zipper_test.py +82 -0
- data/tracks/racket/.travis.yml +1 -1
- data/tracks/racket/config.json +14 -0
- data/tracks/racket/exercises/meetup/README.md +54 -0
- data/tracks/racket/exercises/meetup/example.rkt +45 -0
- data/tracks/racket/exercises/meetup/meetup-test.rkt +39 -0
- data/tracks/racket/exercises/meetup/meetup.rkt +3 -0
- metadata +29 -2
@@ -1,25 +1,21 @@
|
|
1
|
-
def
|
2
|
-
return [
|
1
|
+
def append(xs, ys):
|
2
|
+
return concat([xs, ys])
|
3
3
|
|
4
4
|
|
5
|
-
def
|
6
|
-
return
|
5
|
+
def concat(lists):
|
6
|
+
return [elem for lst in lists for elem in lst]
|
7
7
|
|
8
8
|
|
9
9
|
def filter_clone(function, xs):
|
10
10
|
return [x for x in xs if function(x)]
|
11
11
|
|
12
12
|
|
13
|
-
def
|
14
|
-
|
15
|
-
return []
|
16
|
-
else:
|
17
|
-
return xs[::-1]
|
13
|
+
def length(xs):
|
14
|
+
return sum(1 for _ in xs)
|
18
15
|
|
19
16
|
|
20
|
-
def
|
21
|
-
|
22
|
-
return xs
|
17
|
+
def map_clone(function, xs):
|
18
|
+
return [function(elem) for elem in xs]
|
23
19
|
|
24
20
|
|
25
21
|
def foldl(function, xs, acc):
|
@@ -36,20 +32,5 @@ def foldr(function, xs, acc):
|
|
36
32
|
return function(xs[0], foldr(function, xs[1:], acc))
|
37
33
|
|
38
34
|
|
39
|
-
def
|
40
|
-
|
41
|
-
for item in xs:
|
42
|
-
if isinstance(item, list):
|
43
|
-
out.extend(flat(item))
|
44
|
-
else:
|
45
|
-
out.append(item)
|
46
|
-
return out
|
47
|
-
|
48
|
-
|
49
|
-
def concat(xs, ys):
|
50
|
-
if not ys:
|
51
|
-
return xs
|
52
|
-
else:
|
53
|
-
for item in ys:
|
54
|
-
xs.append(item)
|
55
|
-
return xs
|
35
|
+
def reverse(xs):
|
36
|
+
return xs[::-1]
|
@@ -1,34 +1,30 @@
|
|
1
|
-
def
|
1
|
+
def append(xs, ys):
|
2
2
|
pass
|
3
3
|
|
4
4
|
|
5
|
-
def
|
5
|
+
def concat(lists):
|
6
6
|
pass
|
7
7
|
|
8
8
|
|
9
|
-
def filter_clone():
|
9
|
+
def filter_clone(function, xs):
|
10
10
|
pass
|
11
11
|
|
12
12
|
|
13
|
-
def
|
13
|
+
def length(xs):
|
14
14
|
pass
|
15
15
|
|
16
16
|
|
17
|
-
def
|
17
|
+
def map_clone(function, xs):
|
18
18
|
pass
|
19
19
|
|
20
20
|
|
21
|
-
def foldl():
|
21
|
+
def foldl(function, xs, acc):
|
22
22
|
pass
|
23
23
|
|
24
24
|
|
25
|
-
def foldr():
|
25
|
+
def foldr(function, xs, acc):
|
26
26
|
pass
|
27
27
|
|
28
28
|
|
29
|
-
def
|
30
|
-
pass
|
31
|
-
|
32
|
-
|
33
|
-
def concat():
|
29
|
+
def reverse(xs):
|
34
30
|
pass
|
@@ -4,122 +4,91 @@ import operator
|
|
4
4
|
import list_ops
|
5
5
|
|
6
6
|
|
7
|
+
# Tests adapted from problem-specifications//canonical-data.json @ v2.0.0
|
8
|
+
|
7
9
|
class ListOpsTest(unittest.TestCase):
|
8
10
|
|
9
|
-
#
|
10
|
-
def
|
11
|
-
self.assertEqual(
|
12
|
-
list_ops.map_clone(lambda x: x**2,
|
13
|
-
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),
|
14
|
-
[1, 4, 9, 16, 25, 36, 49, 64, 81, 100])
|
11
|
+
# test for append
|
12
|
+
def test_append_empty_lists(self):
|
13
|
+
self.assertEqual(list_ops.append([], []), [])
|
15
14
|
|
16
|
-
def
|
17
|
-
self.assertEqual(
|
18
|
-
list_ops.map_clone(lambda x: x**3,
|
19
|
-
[-1, 2, -3, 4, -5, 6, -7, 8, -9, 10]),
|
20
|
-
[-1, 8, -27, 64, -125, 216, -343, 512, -729, 1000])
|
15
|
+
def test_append_empty_list_to_list(self):
|
16
|
+
self.assertEqual(list_ops.append([], [1, 2, 3, 4]), [1, 2, 3, 4])
|
21
17
|
|
22
|
-
def
|
23
|
-
self.assertEqual(
|
24
|
-
|
25
|
-
[-1, 2, -3, 4, -5, 6, -7, 8, -9, 10]),
|
26
|
-
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
|
18
|
+
def test_append_nonempty_lists(self):
|
19
|
+
self.assertEqual(list_ops.append([1, 2], [2, 3, 4, 5]),
|
20
|
+
[1, 2, 2, 3, 4, 5])
|
27
21
|
|
28
|
-
|
29
|
-
|
22
|
+
# tests for concat
|
23
|
+
def test_concat_empty_list(self):
|
24
|
+
self.assertEqual(list_ops.concat([]), [])
|
30
25
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
list_ops.length([-1, 2, -3, 4, -5, 6, -7, 8, -9, 10]), 10)
|
26
|
+
def test_concat_list_of_lists(self):
|
27
|
+
self.assertEqual(list_ops.concat([[1, 2], [3], [], [4, 5, 6]]),
|
28
|
+
[1, 2, 3, 4, 5, 6])
|
35
29
|
|
36
|
-
|
37
|
-
|
30
|
+
# tests for filter_clone
|
31
|
+
def test_filter_empty_list(self):
|
32
|
+
self.assertEqual(list_ops.filter_clone(lambda x: x % 2 == 1, []), [])
|
38
33
|
|
39
|
-
|
40
|
-
def test_filter_odd(self):
|
34
|
+
def test_filter_nonempty_list(self):
|
41
35
|
self.assertEqual(
|
42
|
-
list_ops.filter_clone(lambda x: x % 2
|
36
|
+
list_ops.filter_clone(lambda x: x % 2 == 1, [1, 2, 3, 4, 5]),
|
43
37
|
[1, 3, 5])
|
44
38
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
[2, 4, 6])
|
49
|
-
|
50
|
-
# tests for reverse
|
51
|
-
def test_reverse_small(self):
|
52
|
-
self.assertEqual(list_ops.reverse([3, 2, 1]), [1, 2, 3])
|
53
|
-
|
54
|
-
def test_reverse_mixed_types(self):
|
55
|
-
self.assertEqual(
|
56
|
-
list_ops.reverse(["xyz", 4.0, "cat", 1]), [1, "cat", 4.0, "xyz"])
|
57
|
-
|
58
|
-
def test_reverse_empty(self):
|
59
|
-
self.assertEqual(list_ops.reverse([]), [])
|
39
|
+
# tests for length
|
40
|
+
def test_length_empty_list(self):
|
41
|
+
self.assertEqual(list_ops.length([]), 0)
|
60
42
|
|
61
|
-
|
62
|
-
|
63
|
-
self.assertEqual(
|
64
|
-
list_ops.append(["10", "python"], "hello"),
|
65
|
-
["10", "python", "hello"])
|
43
|
+
def test_length_nonempty_list(self):
|
44
|
+
self.assertEqual(list_ops.length([1, 2, 3, 4]), 4)
|
66
45
|
|
67
|
-
|
68
|
-
|
69
|
-
|
46
|
+
# tests for map_clone
|
47
|
+
def test_map_empty_list(self):
|
48
|
+
self.assertEqual(list_ops.map_clone(lambda x: x + 1, []), [])
|
70
49
|
|
71
|
-
def
|
72
|
-
self.assertEqual(list_ops.
|
50
|
+
def test_map_nonempty_list(self):
|
51
|
+
self.assertEqual(list_ops.map_clone(lambda x: x + 1, [1, 3, 5, 7]),
|
52
|
+
[2, 4, 6, 8])
|
73
53
|
|
74
54
|
# tests for foldl
|
75
|
-
def
|
76
|
-
self.assertEqual(
|
77
|
-
list_ops.foldl(operator.add, [1, 2, 3, 4, 5, 6], 0), 21)
|
55
|
+
def test_foldl_empty_list(self):
|
56
|
+
self.assertEqual(list_ops.foldl(operator.mul, [], 2), 2)
|
78
57
|
|
79
|
-
def
|
80
|
-
self.assertEqual(
|
81
|
-
list_ops.foldl(operator.mul, [1, 2, 3, 4, 5, 6], 1), 720)
|
58
|
+
def test_foldl_nonempty_list_addition(self):
|
59
|
+
self.assertEqual(list_ops.foldl(operator.add, [1, 2, 3, 4], 5), 15)
|
82
60
|
|
83
|
-
def
|
84
|
-
self.assertEqual(
|
85
|
-
list_ops.foldl(operator.floordiv, [1, 2, 3, 4, 5, 6], 1), 0)
|
86
|
-
|
87
|
-
def test_foldl_sub(self):
|
88
|
-
self.assertEqual(list_ops.foldl(operator.sub, [1, 2, 3, 4, 5], 0), -15)
|
61
|
+
def test_foldl_nonempty_list_floordiv(self):
|
62
|
+
self.assertEqual(list_ops.foldl(operator.floordiv, [2, 5], 5), 0)
|
89
63
|
|
90
64
|
# tests for foldr
|
91
|
-
def
|
92
|
-
self.assertEqual(list_ops.foldr(operator.
|
65
|
+
def test_foldr_empty_list(self):
|
66
|
+
self.assertEqual(list_ops.foldr(operator.mul, [], 2), 2)
|
67
|
+
|
68
|
+
def test_foldr_nonempty_list_addition(self):
|
69
|
+
self.assertEqual(list_ops.foldr(operator.add, [1, 2, 3, 4], 5), 15)
|
70
|
+
|
71
|
+
def test_foldr_nonempty_list_floordiv(self):
|
72
|
+
self.assertEqual(list_ops.foldr(operator.floordiv, [2, 5], 5), 2)
|
93
73
|
|
74
|
+
# additional test for foldr
|
94
75
|
def test_foldr_add_str(self):
|
95
76
|
self.assertEqual(
|
96
77
|
list_ops.foldr(operator.add,
|
97
78
|
["e", "x", "e", "r", "c", "i", "s", "m"], "!"),
|
98
79
|
"exercism!")
|
99
80
|
|
100
|
-
# tests for
|
101
|
-
def
|
102
|
-
self.assertEqual(list_ops.
|
103
|
-
|
104
|
-
def test_flatten_once(self):
|
105
|
-
self.assertEqual(list_ops.flat([["x", "y", "z"]]), ["x", "y", "z"])
|
81
|
+
# tests for reverse
|
82
|
+
def test_reverse_empty_list(self):
|
83
|
+
self.assertEqual(list_ops.reverse([]), [])
|
106
84
|
|
107
|
-
def
|
108
|
-
self.assertEqual(list_ops.
|
85
|
+
def test_reverse_nonempty_list(self):
|
86
|
+
self.assertEqual(list_ops.reverse([1, 3, 5, 7]), [7, 5, 3, 1])
|
109
87
|
|
110
|
-
#
|
111
|
-
def
|
112
|
-
self.assertEqual(
|
113
|
-
list_ops.concat([1, 3, 5, 8], [9, 4, 5, 6]),
|
114
|
-
[1, 3, 5, 8, 9, 4, 5, 6])
|
115
|
-
|
116
|
-
def test_concat_nothing(self):
|
88
|
+
# additional test for reverse
|
89
|
+
def test_reverse_mixed_types(self):
|
117
90
|
self.assertEqual(
|
118
|
-
list_ops.
|
119
|
-
["orange", "apple", "banana"])
|
120
|
-
|
121
|
-
def test_concat_empty(self):
|
122
|
-
self.assertEqual(list_ops.concat([], []), [])
|
91
|
+
list_ops.reverse(["xyz", 4.0, "cat", 1]), [1, "cat", 4.0, "xyz"])
|
123
92
|
|
124
93
|
|
125
94
|
if __name__ == '__main__':
|
@@ -399,8 +399,8 @@ class MeetupTest(unittest.TestCase):
|
|
399
399
|
meetup_day(2015, 3, 'Monday', '5th'), date(2015, 3, 30))
|
400
400
|
|
401
401
|
def test_nonexistent_fifth_monday_of_february_2015(self):
|
402
|
-
self.assertRaises(MeetupDayException
|
403
|
-
|
402
|
+
with self.assertRaises(MeetupDayException):
|
403
|
+
meetup_day(2015, 2, 'Monday', '5th')
|
404
404
|
|
405
405
|
|
406
406
|
if __name__ == '__main__':
|
@@ -141,19 +141,22 @@ class MinesweeperTest(unittest.TestCase):
|
|
141
141
|
"|* |",
|
142
142
|
"| |",
|
143
143
|
"+-+"]
|
144
|
-
self.assertRaises(ValueError
|
144
|
+
with self.assertRaises(ValueError):
|
145
|
+
board(inp)
|
145
146
|
|
146
147
|
def test_faulty_border(self):
|
147
148
|
inp = ["+-----+",
|
148
149
|
"* * |",
|
149
150
|
"+-- --+"]
|
150
|
-
self.assertRaises(ValueError
|
151
|
+
with self.assertRaises(ValueError):
|
152
|
+
board(inp)
|
151
153
|
|
152
154
|
def test_invalid_char(self):
|
153
155
|
inp = ["+-----+",
|
154
156
|
"|X * |",
|
155
157
|
"+-----+"]
|
156
|
-
self.assertRaises(ValueError
|
158
|
+
with self.assertRaises(ValueError):
|
159
|
+
board(inp)
|
157
160
|
|
158
161
|
|
159
162
|
if __name__ == '__main__':
|
@@ -43,15 +43,17 @@ class OcrTest(unittest.TestCase):
|
|
43
43
|
" "]), '?')
|
44
44
|
|
45
45
|
def test_too_short_row(self):
|
46
|
-
self.assertRaises(ValueError
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
with self.assertRaises(ValueError):
|
47
|
+
number([" ",
|
48
|
+
" _|",
|
49
|
+
" |",
|
50
|
+
" "])
|
50
51
|
|
51
52
|
def test_insufficient_rows(self):
|
52
|
-
self.assertRaises(ValueError
|
53
|
-
|
54
|
-
|
53
|
+
with self.assertRaises(ValueError):
|
54
|
+
number([" ",
|
55
|
+
" _|",
|
56
|
+
" X|"])
|
55
57
|
|
56
58
|
def test_grid0(self):
|
57
59
|
self.assertEqual(grid('0'), [" _ ",
|
@@ -114,7 +116,8 @@ class OcrTest(unittest.TestCase):
|
|
114
116
|
])
|
115
117
|
|
116
118
|
def test_invalid_grid(self):
|
117
|
-
self.assertRaises(ValueError
|
119
|
+
with self.assertRaises(ValueError):
|
120
|
+
grid('123a')
|
118
121
|
|
119
122
|
|
120
123
|
if __name__ == '__main__':
|
@@ -7,39 +7,48 @@ from pangram import is_pangram
|
|
7
7
|
|
8
8
|
class PangramTests(unittest.TestCase):
|
9
9
|
def test_sentence_empty(self):
|
10
|
-
self.
|
10
|
+
self.assertIs(is_pangram(''), False)
|
11
11
|
|
12
12
|
def test_pangram_with_only_lower_case(self):
|
13
|
-
self.
|
14
|
-
is_pangram('the quick brown fox jumps over the lazy dog')
|
13
|
+
self.assertIs(
|
14
|
+
is_pangram('the quick brown fox jumps over the lazy dog'),
|
15
|
+
True)
|
15
16
|
|
16
17
|
def test_missing_character_x(self):
|
17
|
-
self.
|
18
|
+
self.assertIs(
|
18
19
|
is_pangram('a quick movement of the enemy will '
|
19
|
-
'jeopardize five gunboats')
|
20
|
+
'jeopardize five gunboats'),
|
21
|
+
False)
|
20
22
|
|
21
23
|
def test_another_missing_character_x(self):
|
22
|
-
self.
|
23
|
-
is_pangram('the quick brown fish jumps over the lazy dog')
|
24
|
+
self.assertIs(
|
25
|
+
is_pangram('the quick brown fish jumps over the lazy dog'),
|
26
|
+
False)
|
24
27
|
|
25
28
|
def test_pangram_with_underscores(self):
|
26
|
-
self.
|
27
|
-
is_pangram('the_quick_brown_fox_jumps_over_the_lazy_dog')
|
29
|
+
self.assertIs(
|
30
|
+
is_pangram('the_quick_brown_fox_jumps_over_the_lazy_dog'),
|
31
|
+
True)
|
28
32
|
|
29
33
|
def test_pangram_with_numbers(self):
|
30
|
-
self.
|
31
|
-
is_pangram('the 1 quick brown fox jumps over the 2 lazy dogs')
|
34
|
+
self.assertIs(
|
35
|
+
is_pangram('the 1 quick brown fox jumps over the 2 lazy dogs'),
|
36
|
+
True)
|
32
37
|
|
33
38
|
def test_missing_letters_replaced_by_numbers(self):
|
34
|
-
self.
|
35
|
-
is_pangram('7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog')
|
39
|
+
self.assertIs(
|
40
|
+
is_pangram('7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog'),
|
41
|
+
False)
|
36
42
|
|
37
43
|
def test_pangram_with_mixedcase_and_punctuation(self):
|
38
|
-
self.
|
44
|
+
self.assertIs(
|
45
|
+
is_pangram('"Five quacking Zephyrs jolt my wax bed."'),
|
46
|
+
True)
|
39
47
|
|
40
48
|
def test_upper_and_lower_case_versions_of_the_same_character(self):
|
41
|
-
self.
|
42
|
-
is_pangram('the quick brown fox jumped over the lazy FOX')
|
49
|
+
self.assertIs(
|
50
|
+
is_pangram('the quick brown fox jumped over the lazy FOX'),
|
51
|
+
False)
|
43
52
|
|
44
53
|
|
45
54
|
if __name__ == '__main__':
|
@@ -1,2 +1,2 @@
|
|
1
|
-
def hamming_distance():
|
1
|
+
def hamming_distance(dna_strand_1, dna_strand_2):
|
2
2
|
pass
|
@@ -80,7 +80,8 @@ class PythagoreanTripletTest(unittest.TestCase):
|
|
80
80
|
self.assertIs(is_triplet((924, 43, 925)), True)
|
81
81
|
|
82
82
|
def test_odd_number(self):
|
83
|
-
self.assertRaises(ValueError
|
83
|
+
with self.assertRaises(ValueError):
|
84
|
+
primitive_triplets(5)
|
84
85
|
|
85
86
|
|
86
87
|
if __name__ == '__main__':
|
@@ -28,7 +28,8 @@ class SaddlePointTest(unittest.TestCase):
|
|
28
28
|
|
29
29
|
def test_irregular_matrix(self):
|
30
30
|
inp = [[3, 2, 1], [0, 1], [2, 1, 0]]
|
31
|
-
self.assertRaises(ValueError
|
31
|
+
with self.assertRaises(ValueError):
|
32
|
+
saddle_points(inp)
|
32
33
|
|
33
34
|
|
34
35
|
if __name__ == '__main__':
|