Skip to content

Commit 3113a8f

Browse files
committed
use python3.8 in CI and run test generator
1 parent db7ed77 commit 3113a8f

File tree

106 files changed

+431
-173
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+431
-173
lines changed

.github/workflows/ci-workflow.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v2
1818

19-
- name: Set up Python 3.7
19+
- name: Set up Python
2020
uses: actions/[email protected]
2121
with:
22-
python-version: 3.7
22+
python-version: 3.8
2323

2424
- name: Download & Install dependencies
2525
run: |

exercises/practice/acronym/acronym_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import unittest
22

3-
from acronym import abbreviate
3+
from acronym import (
4+
abbreviate,
5+
)
46

57
# Tests adapted from `problem-specifications//canonical-data.json`
68

exercises/practice/affine-cipher/affine_cipher_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import unittest
22

3-
from affine_cipher import decode, encode
3+
from affine_cipher import (
4+
decode,
5+
encode,
6+
)
47

58
# Tests adapted from `problem-specifications//canonical-data.json`
69

exercises/practice/all-your-base/all_your_base_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import unittest
22

3-
from all_your_base import rebase
3+
from all_your_base import (
4+
rebase,
5+
)
46

57
# Tests adapted from `problem-specifications//canonical-data.json`
68

exercises/practice/allergies/allergies_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import unittest
22

3-
from allergies import Allergies
3+
from allergies import (
4+
Allergies,
5+
)
46

57
# Tests adapted from `problem-specifications//canonical-data.json`
68

exercises/practice/alphametics/alphametics_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import unittest
22

3-
from alphametics import solve
3+
from alphametics import (
4+
solve,
5+
)
46

57
# Tests adapted from `problem-specifications//canonical-data.json`
68

exercises/practice/anagram/anagram_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import unittest
22

3-
from anagram import find_anagrams
3+
from anagram import (
4+
find_anagrams,
5+
)
46

57
# Tests adapted from `problem-specifications//canonical-data.json`
68

exercises/practice/armstrong-numbers/armstrong_numbers_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import unittest
22

3-
from armstrong_numbers import is_armstrong_number
3+
from armstrong_numbers import (
4+
is_armstrong_number,
5+
)
46

57
# Tests adapted from `problem-specifications//canonical-data.json`
68

exercises/practice/atbash-cipher/atbash_cipher_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import unittest
22

3-
from atbash_cipher import decode, encode
3+
from atbash_cipher import (
4+
decode,
5+
encode,
6+
)
47

58
# Tests adapted from `problem-specifications//canonical-data.json`
69

exercises/practice/beer-song/beer_song_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import unittest
22

3-
from beer_song import recite
3+
from beer_song import (
4+
recite,
5+
)
46

57
# Tests adapted from `problem-specifications//canonical-data.json`
68

exercises/practice/binary-search-tree/binary_search_tree_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import unittest
22

3-
from binary_search_tree import BinarySearchTree, TreeNode
3+
from binary_search_tree import (
4+
BinarySearchTree,
5+
TreeNode,
6+
)
47

58
# Tests adapted from `problem-specifications//canonical-data.json`
69

exercises/practice/binary-search/binary_search_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import unittest
22

3-
from binary_search import find
3+
from binary_search import (
4+
find,
5+
)
46

57
# Tests adapted from `problem-specifications//canonical-data.json`
68

exercises/practice/bob/bob_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import unittest
22

3-
from bob import response
3+
from bob import (
4+
response,
5+
)
46

57
# Tests adapted from `problem-specifications//canonical-data.json`
68

exercises/practice/book-store/book_store_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import unittest
22

3-
from book_store import total
3+
from book_store import (
4+
total,
5+
)
46

57
# Tests adapted from `problem-specifications//canonical-data.json`
68

@@ -63,7 +65,7 @@ def test_three_each_of_first_2_books_and_2_each_of_remaining_books(self):
6365
self.assertEqual(total(basket), 7520)
6466

6567
def test_four_groups_of_four_are_cheaper_than_two_groups_each_of_five_and_three(
66-
self
68+
self,
6769
):
6870
basket = [1, 1, 2, 2, 3, 3, 4, 5, 1, 1, 2, 2, 3, 3, 4, 5]
6971
self.assertEqual(total(basket), 10240)

exercises/practice/bowling/bowling_test.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import unittest
22

3-
from bowling import BowlingGame
3+
from bowling import (
4+
BowlingGame,
5+
)
46

57
# Tests adapted from `problem-specifications//canonical-data.json`
68

@@ -48,7 +50,7 @@ def test_a_strike_earns_ten_points_in_a_frame_with_a_single_roll(self):
4850
self.assertEqual(game.score(), 10)
4951

5052
def test_points_scored_in_the_two_rolls_after_a_strike_are_counted_twice_as_a_bonus(
51-
self
53+
self,
5254
):
5355
rolls = [10, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
5456
game = self.roll_new_game(rolls)
@@ -60,7 +62,7 @@ def test_consecutive_strikes_each_get_the_two_roll_bonus(self):
6062
self.assertEqual(game.score(), 81)
6163

6264
def test_a_strike_in_the_last_frame_gets_a_two_roll_bonus_that_is_counted_once(
63-
self
65+
self,
6466
):
6567
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 1]
6668
game = self.roll_new_game(rolls)
@@ -77,7 +79,7 @@ def test_strikes_with_the_two_roll_bonus_do_not_get_bonus_rolls(self):
7779
self.assertEqual(game.score(), 30)
7880

7981
def test_a_strike_with_the_one_roll_bonus_after_a_spare_in_the_last_frame_does_not_get_a_bonus(
80-
self
82+
self,
8183
):
8284
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 10]
8385
game = self.roll_new_game(rolls)
@@ -107,38 +109,38 @@ def test_two_rolls_in_a_frame_cannot_score_more_than_10_points(self):
107109
game.roll(6)
108110

109111
def test_bonus_roll_after_a_strike_in_the_last_frame_cannot_score_more_than_10_points(
110-
self
112+
self,
111113
):
112114
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10]
113115
game = self.roll_new_game(rolls)
114116
with self.assertRaisesWithMessage(Exception):
115117
game.roll(11)
116118

117119
def test_two_bonus_rolls_after_a_strike_in_the_last_frame_cannot_score_more_than_10_points(
118-
self
120+
self,
119121
):
120122
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 5]
121123
game = self.roll_new_game(rolls)
122124
with self.assertRaisesWithMessage(Exception):
123125
game.roll(6)
124126

125127
def test_two_bonus_rolls_after_a_strike_in_the_last_frame_can_score_more_than_10_points_if_one_is_a_strike(
126-
self
128+
self,
127129
):
128130
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 6]
129131
game = self.roll_new_game(rolls)
130132
self.assertEqual(game.score(), 26)
131133

132134
def test_the_second_bonus_rolls_after_a_strike_in_the_last_frame_cannot_be_a_strike_if_the_first_one_is_not_a_strike(
133-
self
135+
self,
134136
):
135137
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 6]
136138
game = self.roll_new_game(rolls)
137139
with self.assertRaisesWithMessage(Exception):
138140
game.roll(10)
139141

140142
def test_second_bonus_roll_after_a_strike_in_the_last_frame_cannot_score_more_than_10_points(
141-
self
143+
self,
142144
):
143145
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10]
144146
game = self.roll_new_game(rolls)
@@ -164,23 +166,23 @@ def test_cannot_roll_if_game_already_has_ten_frames(self):
164166
game.roll(0)
165167

166168
def test_bonus_rolls_for_a_strike_in_the_last_frame_must_be_rolled_before_score_can_be_calculated(
167-
self
169+
self,
168170
):
169171
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10]
170172
game = self.roll_new_game(rolls)
171173
with self.assertRaisesWithMessage(Exception):
172174
game.roll()
173175

174176
def test_both_bonus_rolls_for_a_strike_in_the_last_frame_must_be_rolled_before_score_can_be_calculated(
175-
self
177+
self,
176178
):
177179
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10]
178180
game = self.roll_new_game(rolls)
179181
with self.assertRaisesWithMessage(Exception):
180182
game.roll()
181183

182184
def test_bonus_roll_for_a_spare_in_the_last_frame_must_be_rolled_before_score_can_be_calculated(
183-
self
185+
self,
184186
):
185187
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3]
186188
game = self.roll_new_game(rolls)

exercises/practice/change/change_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import unittest
22

3-
from change import find_fewest_coins
3+
from change import (
4+
find_fewest_coins,
5+
)
46

57
# Tests adapted from `problem-specifications//canonical-data.json`
68

exercises/practice/circular-buffer/circular_buffer_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import unittest
22

3-
from circular_buffer import CircularBuffer
3+
from circular_buffer import (
4+
CircularBuffer,
5+
)
46

57
# Tests adapted from `problem-specifications//canonical-data.json`
68

@@ -88,7 +90,7 @@ def test_overwrite_replaces_the_oldest_item_on_full_buffer(self):
8890
self.assertEqual(buf.read(), "3")
8991

9092
def test_overwrite_replaces_the_oldest_item_remaining_in_buffer_following_a_read(
91-
self
93+
self,
9294
):
9395
buf = CircularBuffer(3)
9496
buf.write("1")

exercises/practice/clock/clock_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import unittest
22

3-
from clock import Clock
3+
from clock import (
4+
Clock,
5+
)
46

57
# Tests adapted from `problem-specifications//canonical-data.json`
68

exercises/practice/collatz-conjecture/collatz_conjecture_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import unittest
22

3-
from collatz_conjecture import steps
3+
from collatz_conjecture import (
4+
steps,
5+
)
46

57
# Tests adapted from `problem-specifications//canonical-data.json`
68

exercises/practice/complex-numbers/complex_numbers_test.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
import unittest
55

6-
from complex_numbers import ComplexNumber
6+
from complex_numbers import (
7+
ComplexNumber,
8+
)
79

810
# Tests adapted from `problem-specifications//canonical-data.json`
911

@@ -108,12 +110,12 @@ def test_absolute_value_of_a_negative_purely_real_number(self):
108110
self.assertEqual(abs(ComplexNumber(-5, 0)), 5)
109111

110112
def test_absolute_value_of_a_purely_imaginary_number_with_positive_imaginary_part(
111-
self
113+
self,
112114
):
113115
self.assertEqual(abs(ComplexNumber(0, 5)), 5)
114116

115117
def test_absolute_value_of_a_purely_imaginary_number_with_negative_imaginary_part(
116-
self
118+
self,
117119
):
118120
self.assertEqual(abs(ComplexNumber(0, -5)), 5)
119121

exercises/practice/connect/connect_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import unittest
22

3-
from connect import ConnectGame
3+
from connect import (
4+
ConnectGame,
5+
)
46

57
# Tests adapted from `problem-specifications//canonical-data.json`
68

exercises/practice/crypto-square/crypto_square_test.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import unittest
22

3-
from crypto_square import cipher_text
3+
from crypto_square import (
4+
cipher_text,
5+
)
46

57
# Tests adapted from `problem-specifications//canonical-data.json`
68

@@ -32,14 +34,14 @@ def test_9_character_plaintext_results_in_3_chunks_of_3_characters(self):
3234
self.assertEqual(cipher_text(value), expected)
3335

3436
def test_8_character_plaintext_results_in_3_chunks_the_last_one_with_a_trailing_space(
35-
self
37+
self,
3638
):
3739
value = "Chill out."
3840
expected = "clu hlt io "
3941
self.assertEqual(cipher_text(value), expected)
4042

4143
def test_54_character_plaintext_results_in_7_chunks_the_last_two_with_trailing_spaces(
42-
self
44+
self,
4345
):
4446
value = "If man was meant to stay on the ground, god would have given us roots."
4547
expected = "imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau "

0 commit comments

Comments
 (0)