Skip to content

Commit

Permalink
use python3.8 in CI and run test generator
Browse files Browse the repository at this point in the history
  • Loading branch information
cmccandless committed Jan 31, 2021
1 parent db7ed77 commit 3113a8f
Show file tree
Hide file tree
Showing 106 changed files with 431 additions and 173 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up Python 3.7
- name: Set up Python
uses: actions/[email protected]
with:
python-version: 3.7
python-version: 3.8

- name: Download & Install dependencies
run: |
Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/acronym/acronym_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import unittest

from acronym import abbreviate
from acronym import (
abbreviate,
)

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

Expand Down
5 changes: 4 additions & 1 deletion exercises/practice/affine-cipher/affine_cipher_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import unittest

from affine_cipher import decode, encode
from affine_cipher import (
decode,
encode,
)

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

Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/all-your-base/all_your_base_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import unittest

from all_your_base import rebase
from all_your_base import (
rebase,
)

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

Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/allergies/allergies_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import unittest

from allergies import Allergies
from allergies import (
Allergies,
)

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

Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/alphametics/alphametics_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import unittest

from alphametics import solve
from alphametics import (
solve,
)

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

Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/anagram/anagram_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import unittest

from anagram import find_anagrams
from anagram import (
find_anagrams,
)

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import unittest

from armstrong_numbers import is_armstrong_number
from armstrong_numbers import (
is_armstrong_number,
)

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

Expand Down
5 changes: 4 additions & 1 deletion exercises/practice/atbash-cipher/atbash_cipher_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import unittest

from atbash_cipher import decode, encode
from atbash_cipher import (
decode,
encode,
)

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

Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/beer-song/beer_song_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import unittest

from beer_song import recite
from beer_song import (
recite,
)

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import unittest

from binary_search_tree import BinarySearchTree, TreeNode
from binary_search_tree import (
BinarySearchTree,
TreeNode,
)

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

Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/binary-search/binary_search_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import unittest

from binary_search import find
from binary_search import (
find,
)

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

Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/bob/bob_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import unittest

from bob import response
from bob import (
response,
)

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

Expand Down
6 changes: 4 additions & 2 deletions exercises/practice/book-store/book_store_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import unittest

from book_store import total
from book_store import (
total,
)

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

Expand Down Expand Up @@ -63,7 +65,7 @@ def test_three_each_of_first_2_books_and_2_each_of_remaining_books(self):
self.assertEqual(total(basket), 7520)

def test_four_groups_of_four_are_cheaper_than_two_groups_each_of_five_and_three(
self
self,
):
basket = [1, 1, 2, 2, 3, 3, 4, 5, 1, 1, 2, 2, 3, 3, 4, 5]
self.assertEqual(total(basket), 10240)
Expand Down
26 changes: 14 additions & 12 deletions exercises/practice/bowling/bowling_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import unittest

from bowling import BowlingGame
from bowling import (
BowlingGame,
)

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

Expand Down Expand Up @@ -48,7 +50,7 @@ def test_a_strike_earns_ten_points_in_a_frame_with_a_single_roll(self):
self.assertEqual(game.score(), 10)

def test_points_scored_in_the_two_rolls_after_a_strike_are_counted_twice_as_a_bonus(
self
self,
):
rolls = [10, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
game = self.roll_new_game(rolls)
Expand All @@ -60,7 +62,7 @@ def test_consecutive_strikes_each_get_the_two_roll_bonus(self):
self.assertEqual(game.score(), 81)

def test_a_strike_in_the_last_frame_gets_a_two_roll_bonus_that_is_counted_once(
self
self,
):
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 1]
game = self.roll_new_game(rolls)
Expand All @@ -77,7 +79,7 @@ def test_strikes_with_the_two_roll_bonus_do_not_get_bonus_rolls(self):
self.assertEqual(game.score(), 30)

def test_a_strike_with_the_one_roll_bonus_after_a_spare_in_the_last_frame_does_not_get_a_bonus(
self
self,
):
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 10]
game = self.roll_new_game(rolls)
Expand Down Expand Up @@ -107,38 +109,38 @@ def test_two_rolls_in_a_frame_cannot_score_more_than_10_points(self):
game.roll(6)

def test_bonus_roll_after_a_strike_in_the_last_frame_cannot_score_more_than_10_points(
self
self,
):
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10]
game = self.roll_new_game(rolls)
with self.assertRaisesWithMessage(Exception):
game.roll(11)

def test_two_bonus_rolls_after_a_strike_in_the_last_frame_cannot_score_more_than_10_points(
self
self,
):
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 5]
game = self.roll_new_game(rolls)
with self.assertRaisesWithMessage(Exception):
game.roll(6)

def test_two_bonus_rolls_after_a_strike_in_the_last_frame_can_score_more_than_10_points_if_one_is_a_strike(
self
self,
):
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 6]
game = self.roll_new_game(rolls)
self.assertEqual(game.score(), 26)

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(
self
self,
):
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 6]
game = self.roll_new_game(rolls)
with self.assertRaisesWithMessage(Exception):
game.roll(10)

def test_second_bonus_roll_after_a_strike_in_the_last_frame_cannot_score_more_than_10_points(
self
self,
):
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10]
game = self.roll_new_game(rolls)
Expand All @@ -164,23 +166,23 @@ def test_cannot_roll_if_game_already_has_ten_frames(self):
game.roll(0)

def test_bonus_rolls_for_a_strike_in_the_last_frame_must_be_rolled_before_score_can_be_calculated(
self
self,
):
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10]
game = self.roll_new_game(rolls)
with self.assertRaisesWithMessage(Exception):
game.roll()

def test_both_bonus_rolls_for_a_strike_in_the_last_frame_must_be_rolled_before_score_can_be_calculated(
self
self,
):
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10]
game = self.roll_new_game(rolls)
with self.assertRaisesWithMessage(Exception):
game.roll()

def test_bonus_roll_for_a_spare_in_the_last_frame_must_be_rolled_before_score_can_be_calculated(
self
self,
):
rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3]
game = self.roll_new_game(rolls)
Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/change/change_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import unittest

from change import find_fewest_coins
from change import (
find_fewest_coins,
)

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

Expand Down
6 changes: 4 additions & 2 deletions exercises/practice/circular-buffer/circular_buffer_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import unittest

from circular_buffer import CircularBuffer
from circular_buffer import (
CircularBuffer,
)

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

Expand Down Expand Up @@ -88,7 +90,7 @@ def test_overwrite_replaces_the_oldest_item_on_full_buffer(self):
self.assertEqual(buf.read(), "3")

def test_overwrite_replaces_the_oldest_item_remaining_in_buffer_following_a_read(
self
self,
):
buf = CircularBuffer(3)
buf.write("1")
Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/clock/clock_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import unittest

from clock import Clock
from clock import (
Clock,
)

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import unittest

from collatz_conjecture import steps
from collatz_conjecture import (
steps,
)

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

Expand Down
8 changes: 5 additions & 3 deletions exercises/practice/complex-numbers/complex_numbers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

import unittest

from complex_numbers import ComplexNumber
from complex_numbers import (
ComplexNumber,
)

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

Expand Down Expand Up @@ -108,12 +110,12 @@ def test_absolute_value_of_a_negative_purely_real_number(self):
self.assertEqual(abs(ComplexNumber(-5, 0)), 5)

def test_absolute_value_of_a_purely_imaginary_number_with_positive_imaginary_part(
self
self,
):
self.assertEqual(abs(ComplexNumber(0, 5)), 5)

def test_absolute_value_of_a_purely_imaginary_number_with_negative_imaginary_part(
self
self,
):
self.assertEqual(abs(ComplexNumber(0, -5)), 5)

Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/connect/connect_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import unittest

from connect import ConnectGame
from connect import (
ConnectGame,
)

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

Expand Down
8 changes: 5 additions & 3 deletions exercises/practice/crypto-square/crypto_square_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import unittest

from crypto_square import cipher_text
from crypto_square import (
cipher_text,
)

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

Expand Down Expand Up @@ -32,14 +34,14 @@ def test_9_character_plaintext_results_in_3_chunks_of_3_characters(self):
self.assertEqual(cipher_text(value), expected)

def test_8_character_plaintext_results_in_3_chunks_the_last_one_with_a_trailing_space(
self
self,
):
value = "Chill out."
expected = "clu hlt io "
self.assertEqual(cipher_text(value), expected)

def test_54_character_plaintext_results_in_7_chunks_the_last_two_with_trailing_spaces(
self
self,
):
value = "If man was meant to stay on the ground, god would have given us roots."
expected = "imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau "
Expand Down
Loading

0 comments on commit 3113a8f

Please sign in to comment.