use python3.8 in CI and run test generator

This commit is contained in:
Corey McCandless
2021-01-31 16:49:12 -05:00
committed by BethanyG
parent f1215657d0
commit ae3be07737
107 changed files with 432 additions and 174 deletions

View File

@@ -16,10 +16,10 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up Python 3.7 - name: Set up Python
uses: actions/setup-python@v2.2.1 uses: actions/setup-python@v2.2.1
with: with:
python-version: 3.7 python-version: 3.8
- name: Download & Install dependencies - name: Download & Install dependencies
run: | run: |

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from acronym import abbreviate from acronym import (
abbreviate,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,9 @@
import unittest import unittest
from affine_cipher import decode, encode from affine_cipher import (
decode,
encode,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from all_your_base import rebase from all_your_base import (
rebase,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from allergies import Allergies from allergies import (
Allergies,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from alphametics import solve from alphametics import (
solve,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from anagram import find_anagrams from anagram import (
find_anagrams,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from armstrong_numbers import is_armstrong_number from armstrong_numbers import (
is_armstrong_number,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,9 @@
import unittest import unittest
from atbash_cipher import decode, encode from atbash_cipher import (
decode,
encode,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from beer_song import recite from beer_song import (
recite,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,9 @@
import unittest import unittest
from binary_search_tree import BinarySearchTree, TreeNode from binary_search_tree import (
BinarySearchTree,
TreeNode,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from binary_search import find from binary_search import (
find,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from bob import response from bob import (
response,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from book_store import total from book_store import (
total,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
@@ -63,7 +65,7 @@ class BookStoreTest(unittest.TestCase):
self.assertEqual(total(basket), 7520) self.assertEqual(total(basket), 7520)
def test_four_groups_of_four_are_cheaper_than_two_groups_each_of_five_and_three( 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] basket = [1, 1, 2, 2, 3, 3, 4, 5, 1, 1, 2, 2, 3, 3, 4, 5]
self.assertEqual(total(basket), 10240) self.assertEqual(total(basket), 10240)

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from bowling import BowlingGame from bowling import (
BowlingGame,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
@@ -48,7 +50,7 @@ class BowlingTest(unittest.TestCase):
self.assertEqual(game.score(), 10) self.assertEqual(game.score(), 10)
def test_points_scored_in_the_two_rolls_after_a_strike_are_counted_twice_as_a_bonus( 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] 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) game = self.roll_new_game(rolls)
@@ -60,7 +62,7 @@ class BowlingTest(unittest.TestCase):
self.assertEqual(game.score(), 81) self.assertEqual(game.score(), 81)
def test_a_strike_in_the_last_frame_gets_a_two_roll_bonus_that_is_counted_once( 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] 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) game = self.roll_new_game(rolls)
@@ -77,7 +79,7 @@ class BowlingTest(unittest.TestCase):
self.assertEqual(game.score(), 30) 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( 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] 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) game = self.roll_new_game(rolls)
@@ -107,7 +109,7 @@ class BowlingTest(unittest.TestCase):
game.roll(6) game.roll(6)
def test_bonus_roll_after_a_strike_in_the_last_frame_cannot_score_more_than_10_points( 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] 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) game = self.roll_new_game(rolls)
@@ -115,7 +117,7 @@ class BowlingTest(unittest.TestCase):
game.roll(11) game.roll(11)
def test_two_bonus_rolls_after_a_strike_in_the_last_frame_cannot_score_more_than_10_points( 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] 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) game = self.roll_new_game(rolls)
@@ -123,14 +125,14 @@ class BowlingTest(unittest.TestCase):
game.roll(6) 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( 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] 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) game = self.roll_new_game(rolls)
self.assertEqual(game.score(), 26) 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( 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] 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) game = self.roll_new_game(rolls)
@@ -138,7 +140,7 @@ class BowlingTest(unittest.TestCase):
game.roll(10) game.roll(10)
def test_second_bonus_roll_after_a_strike_in_the_last_frame_cannot_score_more_than_10_points( 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] 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) game = self.roll_new_game(rolls)
@@ -164,7 +166,7 @@ class BowlingTest(unittest.TestCase):
game.roll(0) game.roll(0)
def test_bonus_rolls_for_a_strike_in_the_last_frame_must_be_rolled_before_score_can_be_calculated( 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] 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) game = self.roll_new_game(rolls)
@@ -172,7 +174,7 @@ class BowlingTest(unittest.TestCase):
game.roll() game.roll()
def test_both_bonus_rolls_for_a_strike_in_the_last_frame_must_be_rolled_before_score_can_be_calculated( 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] 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) game = self.roll_new_game(rolls)
@@ -180,7 +182,7 @@ class BowlingTest(unittest.TestCase):
game.roll() game.roll()
def test_bonus_roll_for_a_spare_in_the_last_frame_must_be_rolled_before_score_can_be_calculated( 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] 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) game = self.roll_new_game(rolls)

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from change import find_fewest_coins from change import (
find_fewest_coins,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from circular_buffer import CircularBuffer from circular_buffer import (
CircularBuffer,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
@@ -88,7 +90,7 @@ class CircularBufferTest(unittest.TestCase):
self.assertEqual(buf.read(), "3") self.assertEqual(buf.read(), "3")
def test_overwrite_replaces_the_oldest_item_remaining_in_buffer_following_a_read( def test_overwrite_replaces_the_oldest_item_remaining_in_buffer_following_a_read(
self self,
): ):
buf = CircularBuffer(3) buf = CircularBuffer(3)
buf.write("1") buf.write("1")

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from clock import Clock from clock import (
Clock,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from collatz_conjecture import steps from collatz_conjecture import (
steps,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -3,7 +3,9 @@ import math
import unittest import unittest
from complex_numbers import ComplexNumber from complex_numbers import (
ComplexNumber,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
@@ -108,12 +110,12 @@ class ComplexNumbersTest(unittest.TestCase):
self.assertEqual(abs(ComplexNumber(-5, 0)), 5) self.assertEqual(abs(ComplexNumber(-5, 0)), 5)
def test_absolute_value_of_a_purely_imaginary_number_with_positive_imaginary_part( def test_absolute_value_of_a_purely_imaginary_number_with_positive_imaginary_part(
self self,
): ):
self.assertEqual(abs(ComplexNumber(0, 5)), 5) self.assertEqual(abs(ComplexNumber(0, 5)), 5)
def test_absolute_value_of_a_purely_imaginary_number_with_negative_imaginary_part( def test_absolute_value_of_a_purely_imaginary_number_with_negative_imaginary_part(
self self,
): ):
self.assertEqual(abs(ComplexNumber(0, -5)), 5) self.assertEqual(abs(ComplexNumber(0, -5)), 5)

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from connect import ConnectGame from connect import (
ConnectGame,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from crypto_square import cipher_text from crypto_square import (
cipher_text,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
@@ -32,14 +34,14 @@ class CryptoSquareTest(unittest.TestCase):
self.assertEqual(cipher_text(value), expected) self.assertEqual(cipher_text(value), expected)
def test_8_character_plaintext_results_in_3_chunks_the_last_one_with_a_trailing_space( def test_8_character_plaintext_results_in_3_chunks_the_last_one_with_a_trailing_space(
self self,
): ):
value = "Chill out." value = "Chill out."
expected = "clu hlt io " expected = "clu hlt io "
self.assertEqual(cipher_text(value), expected) self.assertEqual(cipher_text(value), expected)
def test_54_character_plaintext_results_in_7_chunks_the_last_two_with_trailing_spaces( 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." 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 " expected = "imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau "

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from custom_set import CustomSet from custom_set import (
CustomSet,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
@@ -154,7 +156,7 @@ class CustomSetTest(unittest.TestCase):
self.assertEqual(set1.intersection(set2), expected) self.assertEqual(set1.intersection(set2), expected)
def test_intersection_of_two_sets_with_shared_elements_is_a_set_of_the_shared_elements( def test_intersection_of_two_sets_with_shared_elements_is_a_set_of_the_shared_elements(
self self,
): ):
set1 = CustomSet([1, 2, 3, 4]) set1 = CustomSet([1, 2, 3, 4])
set2 = CustomSet([3, 2, 5]) set2 = CustomSet([3, 2, 5])
@@ -180,7 +182,7 @@ class CustomSetTest(unittest.TestCase):
self.assertEqual(set1 - set2, expected) self.assertEqual(set1 - set2, expected)
def test_difference_of_two_non_empty_sets_is_a_set_of_elements_that_are_only_in_the_first_set( def test_difference_of_two_non_empty_sets_is_a_set_of_elements_that_are_only_in_the_first_set(
self self,
): ):
set1 = CustomSet([3, 2, 1]) set1 = CustomSet([3, 2, 1])
set2 = CustomSet([2, 4]) set2 = CustomSet([2, 4])

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from darts import score from darts import (
score,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from diamond import rows from diamond import (
rows,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,10 @@
import unittest import unittest
from difference_of_squares import difference_of_squares, square_of_sum, sum_of_squares from difference_of_squares import (
difference_of_squares,
square_of_sum,
sum_of_squares,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,10 @@
import unittest import unittest
from diffie_hellman import private_key, public_key, secret from diffie_hellman import (
private_key,
public_key,
secret,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
@@ -24,13 +28,27 @@ class DiffieHellmanTest(unittest.TestCase):
p = 23 p = 23
g = 5 g = 5
private_key = 6 private_key = 6
self.assertEqual(8, public_key(p, g, private_key)) self.assertEqual(
8,
public_key(
p,
g,
private_key,
),
)
def test_can_calculate_secret_using_other_party_s_public_key(self): def test_can_calculate_secret_using_other_party_s_public_key(self):
p = 23 p = 23
their_public_key = 19 their_public_key = 19
my_private_key = 6 my_private_key = 6
self.assertEqual(2, secret(p, their_public_key, my_private_key)) self.assertEqual(
2,
secret(
p,
their_public_key,
my_private_key,
),
)
def test_key_exchange(self): def test_key_exchange(self):
p = 23 p = 23

View File

@@ -1,6 +1,9 @@
import unittest import unittest
from dnd_character import Character, modifier from dnd_character import (
Character,
modifier,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from dominoes import can_chain from dominoes import (
can_chain,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from etl import transform from etl import (
transform,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from flatten_array import flatten from flatten_array import (
flatten,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from food_chain import recite from food_chain import (
recite,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,9 @@
import unittest import unittest
from forth import evaluate, StackUnderflowError from forth import (
evaluate,
StackUnderflowError,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,7 +1,9 @@
from datetime import datetime from datetime import datetime
import unittest import unittest
from gigasecond import add from gigasecond import (
add,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,11 @@
import unittest import unittest
from go_counting import Board, WHITE, BLACK, NONE from go_counting import (
Board,
WHITE,
BLACK,
NONE,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from grade_school import School from grade_school import (
School,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
@@ -12,7 +14,7 @@ class GradeSchoolTest(unittest.TestCase):
expected = ["Aimee"] expected = ["Aimee"]
self.assertEqual(school.roster(), expected) self.assertEqual(school.roster(), expected)
def test_adding_more_student_adds_them_to_the_sorted_roster(self): def test_adding_more_students_adds_them_to_the_sorted_roster(self):
school = School() school = School()
school.add_student(name="Blair", grade=2) school.add_student(name="Blair", grade=2)
school.add_student(name="James", grade=2) school.add_student(name="James", grade=2)
@@ -21,7 +23,7 @@ class GradeSchoolTest(unittest.TestCase):
self.assertEqual(school.roster(), expected) self.assertEqual(school.roster(), expected)
def test_adding_students_to_different_grades_adds_them_to_the_same_sorted_roster( def test_adding_students_to_different_grades_adds_them_to_the_same_sorted_roster(
self self,
): ):
school = School() school = School()
school.add_student(name="Chelsea", grade=3) school.add_student(name="Chelsea", grade=3)

View File

@@ -1,30 +1,33 @@
import unittest import unittest
from grains import square, total from grains import (
square,
total,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
class GrainsTest(unittest.TestCase): class GrainsTest(unittest.TestCase):
def test_1(self): def test_grains_on_square_1(self):
self.assertEqual(square(1), 1) self.assertEqual(square(1), 1)
def test_2(self): def test_grains_on_square_2(self):
self.assertEqual(square(2), 2) self.assertEqual(square(2), 2)
def test_3(self): def test_grains_on_square_3(self):
self.assertEqual(square(3), 4) self.assertEqual(square(3), 4)
def test_4(self): def test_grains_on_square_4(self):
self.assertEqual(square(4), 8) self.assertEqual(square(4), 8)
def test_16(self): def test_grains_on_square_16(self):
self.assertEqual(square(16), 32768) self.assertEqual(square(16), 32768)
def test_32(self): def test_grains_on_square_32(self):
self.assertEqual(square(32), 2147483648) self.assertEqual(square(32), 2147483648)
def test_64(self): def test_grains_on_square_64(self):
self.assertEqual(square(64), 9223372036854775808) self.assertEqual(square(64), 9223372036854775808)
def test_square_0_raises_an_exception(self): def test_square_0_raises_an_exception(self):

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from grep import grep from grep import (
grep,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
import io import io

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from hamming import distance from hamming import (
distance,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from hello_world import hello from hello_world import (
hello,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,10 @@
import unittest import unittest
from high_scores import latest, personal_best, personal_top_three from high_scores import (
latest,
personal_best,
personal_top_three,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from house import recite from house import (
recite,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from isbn_verifier import is_valid from isbn_verifier import (
is_valid,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from isogram import is_isogram from isogram import (
is_isogram,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from kindergarten_garden import Garden from kindergarten_garden import (
Garden,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
@@ -32,23 +34,23 @@ class KindergartenGardenTest(unittest.TestCase):
garden = Garden("VVCCGG\nVVCCGG") garden = Garden("VVCCGG\nVVCCGG")
self.assertEqual(garden.plants("Charlie"), ["Grass", "Grass", "Grass", "Grass"]) self.assertEqual(garden.plants("Charlie"), ["Grass", "Grass", "Grass", "Grass"])
def test_full_garden_first_student_s_garden(self): def test_full_garden_for_alice_first_student_s_garden(self):
garden = Garden("VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV") garden = Garden("VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV")
self.assertEqual( self.assertEqual(
garden.plants("Alice"), ["Violets", "Radishes", "Violets", "Radishes"] garden.plants("Alice"), ["Violets", "Radishes", "Violets", "Radishes"]
) )
def test_full_garden_second_student_s_garden(self): def test_full_garden_for_bob_second_student_s_garden(self):
garden = Garden("VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV") garden = Garden("VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV")
self.assertEqual(garden.plants("Bob"), ["Clover", "Grass", "Clover", "Clover"]) self.assertEqual(garden.plants("Bob"), ["Clover", "Grass", "Clover", "Clover"])
def test_full_garden_second_to_last_student_s_garden(self): def test_full_garden_for_kincaid_second_to_last_student_s_garden(self):
garden = Garden("VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV") garden = Garden("VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV")
self.assertEqual( self.assertEqual(
garden.plants("Kincaid"), ["Grass", "Clover", "Clover", "Grass"] garden.plants("Kincaid"), ["Grass", "Clover", "Clover", "Grass"]
) )
def test_full_garden_last_student_s_garden(self): def test_full_garden_for_larry_last_student_s_garden(self):
garden = Garden("VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV") garden = Garden("VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV")
self.assertEqual( self.assertEqual(
garden.plants("Larry"), ["Grass", "Violets", "Clover", "Violets"] garden.plants("Larry"), ["Grass", "Violets", "Clover", "Violets"]

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from knapsack import maximum_value from knapsack import (
maximum_value,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from largest_series_product import largest_product from largest_series_product import (
largest_product,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from leap import leap_year from leap import (
leap_year,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
@@ -24,7 +26,7 @@ class LeapTest(unittest.TestCase):
def test_year_divisible_by_100_but_not_by_3_is_still_not_a_leap_year(self): def test_year_divisible_by_100_but_not_by_3_is_still_not_a_leap_year(self):
self.assertIs(leap_year(1900), False) self.assertIs(leap_year(1900), False)
def test_year_divisible_by_400_in_leap_year(self): def test_year_divisible_by_400_is_leap_year(self):
self.assertIs(leap_year(2000), True) self.assertIs(leap_year(2000), True)
def test_year_divisible_by_400_but_not_by_125_is_still_a_leap_year(self): def test_year_divisible_by_400_but_not_by_125_is_still_a_leap_year(self):

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from luhn import Luhn from luhn import (
Luhn,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from markdown import parse from markdown import (
parse,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
@@ -50,7 +52,7 @@ class MarkdownTest(unittest.TestCase):
) )
def test_with_markdown_symbols_in_the_header_text_that_should_not_be_interpreted( def test_with_markdown_symbols_in_the_header_text_that_should_not_be_interpreted(
self self,
): ):
self.assertEqual( self.assertEqual(
parse("# This is a header with # and * in the text"), parse("# This is a header with # and * in the text"),
@@ -58,7 +60,7 @@ class MarkdownTest(unittest.TestCase):
) )
def test_with_markdown_symbols_in_the_list_item_text_that_should_not_be_interpreted( def test_with_markdown_symbols_in_the_list_item_text_that_should_not_be_interpreted(
self self,
): ):
self.assertEqual( self.assertEqual(
parse("* Item 1 with a # in the text\n* Item 2 with * in the text"), parse("* Item 1 with a # in the text\n* Item 2 with * in the text"),
@@ -66,7 +68,7 @@ class MarkdownTest(unittest.TestCase):
) )
def test_with_markdown_symbols_in_the_paragraph_text_that_should_not_be_interpreted( def test_with_markdown_symbols_in_the_paragraph_text_that_should_not_be_interpreted(
self self,
): ):
self.assertEqual( self.assertEqual(
parse("This is a paragraph with # and * in the text"), parse("This is a paragraph with # and * in the text"),

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from matching_brackets import is_paired from matching_brackets import (
is_paired,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from matrix import Matrix from matrix import (
Matrix,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,7 +1,10 @@
from datetime import date from datetime import date
import unittest import unittest
from meetup import meetup, MeetupDayException from meetup import (
meetup,
MeetupDayException,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from minesweeper import annotate from minesweeper import (
annotate,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from nth_prime import prime from nth_prime import (
prime,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from ocr_numbers import convert from ocr_numbers import (
convert,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
@@ -16,13 +18,13 @@ class OcrNumbersTest(unittest.TestCase):
self.assertEqual(convert([" ", " _", " |", " "]), "?") self.assertEqual(convert([" ", " _", " |", " "]), "?")
def test_input_with_a_number_of_lines_that_is_not_a_multiple_of_four_raises_an_error( def test_input_with_a_number_of_lines_that_is_not_a_multiple_of_four_raises_an_error(
self self,
): ):
with self.assertRaisesWithMessage(ValueError): with self.assertRaisesWithMessage(ValueError):
convert([" _ ", "| |", " "]) convert([" _ ", "| |", " "])
def test_input_with_a_number_of_columns_that_is_not_a_multiple_of_three_raises_an_error( def test_input_with_a_number_of_columns_that_is_not_a_multiple_of_three_raises_an_error(
self self,
): ):
with self.assertRaisesWithMessage(ValueError): with self.assertRaisesWithMessage(ValueError):
convert([" ", " |", " |", " "]) convert([" ", " |", " |", " "])
@@ -91,7 +93,7 @@ class OcrNumbersTest(unittest.TestCase):
) )
def test_numbers_separated_by_empty_lines_are_recognized_lines_are_joined_by_commas( def test_numbers_separated_by_empty_lines_are_recognized_lines_are_joined_by_commas(
self self,
): ):
self.assertEqual( self.assertEqual(
convert( convert(

View File

@@ -1,6 +1,9 @@
import unittest import unittest
from palindrome_products import largest, smallest from palindrome_products import (
largest,
smallest,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from pangram import is_pangram from pangram import (
is_pangram,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from perfect_numbers import classify from perfect_numbers import (
classify,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from phone_number import PhoneNumber from phone_number import (
PhoneNumber,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from pig_latin import translate from pig_latin import (
translate,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from poker import best_hands from poker import (
best_hands,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
@@ -29,7 +31,7 @@ class PokerTest(unittest.TestCase):
) )
def test_multiple_hands_with_the_same_high_cards_tie_compares_next_highest_ranked_down_to_last_card( def test_multiple_hands_with_the_same_high_cards_tie_compares_next_highest_ranked_down_to_last_card(
self self,
): ):
self.assertEqual( self.assertEqual(
best_hands(["3S 5H 6S 8D 7H", "2S 5D 6D 8C 7S"]), ["3S 5H 6S 8D 7H"] best_hands(["3S 5H 6S 8D 7H", "2S 5D 6D 8C 7S"]), ["3S 5H 6S 8D 7H"]
@@ -56,14 +58,14 @@ class PokerTest(unittest.TestCase):
) )
def test_both_hands_have_two_pairs_with_the_same_highest_ranked_pair_tie_goes_to_low_pair( def test_both_hands_have_two_pairs_with_the_same_highest_ranked_pair_tie_goes_to_low_pair(
self self,
): ):
self.assertEqual( self.assertEqual(
best_hands(["2S QS 2C QD JH", "JD QH JS 8D QC"]), ["JD QH JS 8D QC"] best_hands(["2S QS 2C QD JH", "JD QH JS 8D QC"]), ["JD QH JS 8D QC"]
) )
def test_both_hands_have_two_identically_ranked_pairs_tie_goes_to_remaining_card_kicker( def test_both_hands_have_two_identically_ranked_pairs_tie_goes_to_remaining_card_kicker(
self self,
): ):
self.assertEqual( self.assertEqual(
best_hands(["JD QH JS 8D QC", "JS QS JC 2D QD"]), ["JD QH JS 8D QC"] best_hands(["JD QH JS 8D QC", "JS QS JC 2D QD"]), ["JD QH JS 8D QC"]
@@ -80,7 +82,7 @@ class PokerTest(unittest.TestCase):
) )
def test_with_multiple_decks_two_players_can_have_same_three_of_a_kind_ties_go_to_highest_remaining_cards( def test_with_multiple_decks_two_players_can_have_same_three_of_a_kind_ties_go_to_highest_remaining_cards(
self self,
): ):
self.assertEqual( self.assertEqual(
best_hands(["4S AH AS 7C AD", "4S AH AS 8C AD"]), ["4S AH AS 8C AD"] best_hands(["4S AH AS 7C AD", "4S AH AS 8C AD"]), ["4S AH AS 8C AD"]
@@ -107,7 +109,7 @@ class PokerTest(unittest.TestCase):
) )
def test_even_though_an_ace_is_usually_high_a_5_high_straight_is_the_lowest_scoring_straight( def test_even_though_an_ace_is_usually_high_a_5_high_straight_is_the_lowest_scoring_straight(
self self,
): ):
self.assertEqual( self.assertEqual(
best_hands(["2H 3C 4D 5D 6H", "4S AH 3S 2D 5H"]), ["2H 3C 4D 5D 6H"] best_hands(["2H 3C 4D 5D 6H", "4S AH 3S 2D 5H"]), ["2H 3C 4D 5D 6H"]
@@ -119,7 +121,7 @@ class PokerTest(unittest.TestCase):
) )
def test_both_hands_have_a_flush_tie_goes_to_high_card_down_to_the_last_one_if_necessary( def test_both_hands_have_a_flush_tie_goes_to_high_card_down_to_the_last_one_if_necessary(
self self,
): ):
self.assertEqual( self.assertEqual(
best_hands(["4H 7H 8H 9H 6H", "2S 4S 5S 6S 7S"]), ["4H 7H 8H 9H 6H"] best_hands(["4H 7H 8H 9H 6H", "2S 4S 5S 6S 7S"]), ["4H 7H 8H 9H 6H"]
@@ -136,7 +138,7 @@ class PokerTest(unittest.TestCase):
) )
def test_with_multiple_decks_both_hands_have_a_full_house_with_the_same_triplet_tie_goes_to_the_pair( def test_with_multiple_decks_both_hands_have_a_full_house_with_the_same_triplet_tie_goes_to_the_pair(
self self,
): ):
self.assertEqual( self.assertEqual(
best_hands(["5H 5S 5D 9S 9D", "5H 5S 5D 8S 8D"]), ["5H 5S 5D 9S 9D"] best_hands(["5H 5S 5D 9S 9D", "5H 5S 5D 8S 8D"]), ["5H 5S 5D 9S 9D"]
@@ -153,7 +155,7 @@ class PokerTest(unittest.TestCase):
) )
def test_with_multiple_decks_both_hands_with_identical_four_of_a_kind_tie_determined_by_kicker( def test_with_multiple_decks_both_hands_with_identical_four_of_a_kind_tie_determined_by_kicker(
self self,
): ):
self.assertEqual( self.assertEqual(
best_hands(["3S 3H 2S 3D 3C", "3S 3H 4S 3D 3C"]), ["3S 3H 4S 3D 3C"] best_hands(["3S 3H 2S 3D 3C", "3S 3H 4S 3D 3C"]), ["3S 3H 4S 3D 3C"]

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from pov import Tree from pov import (
Tree,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from prime_factors import factors from prime_factors import (
factors,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from protein_translation import proteins from protein_translation import (
proteins,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from pythagorean_triplet import triplets_with_sum from pythagorean_triplet import (
triplets_with_sum,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from queen_attack import Queen from queen_attack import (
Queen,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
@@ -27,7 +29,7 @@ class QueenAttackTest(unittest.TestCase):
Queen(4, 8) Queen(4, 8)
# Test the ability of one queen to attack another # Test the ability of one queen to attack another
def test_can_not_attack(self): def test_cannot_attack(self):
self.assertIs(Queen(2, 4).can_attack(Queen(6, 6)), False) self.assertIs(Queen(2, 4).can_attack(Queen(6, 6)), False)
def test_can_attack_on_same_row(self): def test_can_attack_on_same_row(self):

View File

@@ -1,6 +1,9 @@
import unittest import unittest
from rail_fence_cipher import decode, encode from rail_fence_cipher import (
decode,
encode,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from raindrops import convert from raindrops import (
convert,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
@@ -22,7 +24,7 @@ class RaindropsTest(unittest.TestCase):
self.assertEqual(convert(6), "Pling") self.assertEqual(convert(6), "Pling")
def test_2_to_the_power_3_does_not_make_a_raindrop_sound_as_3_is_the_exponent_not_the_base( def test_2_to_the_power_3_does_not_make_a_raindrop_sound_as_3_is_the_exponent_not_the_base(
self self,
): ):
self.assertEqual(convert(8), "8") self.assertEqual(convert(8), "8")

View File

@@ -1,7 +1,9 @@
from __future__ import division from __future__ import division
import unittest import unittest
from rational_numbers import Rational from rational_numbers import (
Rational,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
@@ -78,7 +80,7 @@ class RationalNumbersTest(unittest.TestCase):
self.assertEqual(abs(Rational(1, 2)), Rational(1, 2)) self.assertEqual(abs(Rational(1, 2)), Rational(1, 2))
def test_absolute_value_of_a_positive_rational_number_with_negative_numerator_and_denominator( def test_absolute_value_of_a_positive_rational_number_with_negative_numerator_and_denominator(
self self,
): ):
self.assertEqual(abs(Rational(-1, -2)), Rational(1, 2)) self.assertEqual(abs(Rational(-1, -2)), Rational(1, 2))
@@ -86,7 +88,7 @@ class RationalNumbersTest(unittest.TestCase):
self.assertEqual(abs(Rational(-1, 2)), Rational(1, 2)) self.assertEqual(abs(Rational(-1, 2)), Rational(1, 2))
def test_absolute_value_of_a_negative_rational_number_with_negative_denominator( def test_absolute_value_of_a_negative_rational_number_with_negative_denominator(
self self,
): ):
self.assertEqual(abs(Rational(1, -2)), Rational(1, 2)) self.assertEqual(abs(Rational(1, -2)), Rational(1, 2))

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from rectangles import rectangles from rectangles import (
rectangles,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from resistor_color_duo import value from resistor_color_duo import (
value,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,9 @@
import unittest import unittest
from resistor_color import color_code, colors from resistor_color import (
color_code,
colors,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from rest_api import RestAPI from rest_api import (
RestAPI,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
import json import json

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from reverse_string import reverse from reverse_string import (
reverse,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from rna_transcription import to_rna from rna_transcription import (
to_rna,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,12 @@
import unittest import unittest
from robot_simulator import Robot, NORTH, EAST, SOUTH, WEST from robot_simulator import (
Robot,
NORTH,
EAST,
SOUTH,
WEST,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from roman_numerals import roman from roman_numerals import (
roman,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
class RomanNumeralsTest(unittest.TestCase): class RomanNumeralsTest(unittest.TestCase):

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from rotational_cipher import rotate from rotational_cipher import (
rotate,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,9 @@
import unittest import unittest
from run_length_encoding import encode, decode from run_length_encoding import (
encode,
decode,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -7,7 +7,9 @@ irregular.
""" """
import unittest import unittest
from saddle_points import saddle_points from saddle_points import (
saddle_points,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
@@ -73,7 +75,7 @@ class SaddlePointsTest(unittest.TestCase):
) )
def test_can_identify_that_saddle_points_in_a_single_column_matrix_are_those_with_the_minimum_value( def test_can_identify_that_saddle_points_in_a_single_column_matrix_are_those_with_the_minimum_value(
self self,
): ):
matrix = [[2], [1], [4], [1]] matrix = [[2], [1], [4], [1]]
self.assertEqual( self.assertEqual(
@@ -82,7 +84,7 @@ class SaddlePointsTest(unittest.TestCase):
) )
def test_can_identify_that_saddle_points_in_a_single_row_matrix_are_those_with_the_maximum_value( def test_can_identify_that_saddle_points_in_a_single_row_matrix_are_those_with_the_maximum_value(
self self,
): ):
matrix = [[2, 5, 3, 5]] matrix = [[2, 5, 3, 5]]
self.assertEqual( self.assertEqual(

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from satellite import tree_from_traversals from satellite import (
tree_from_traversals,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from say import say from say import (
say,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from scale_generator import Scale from scale_generator import (
Scale,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from scrabble_score import score from scrabble_score import (
score,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from secret_handshake import commands from secret_handshake import (
commands,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from series import slices from series import (
slices,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,9 @@
import unittest import unittest
from sgf_parsing import parse, SgfTree from sgf_parsing import (
parse,
SgfTree,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from sieve import primes from sieve import (
primes,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,7 +1,9 @@
import re import re
import unittest import unittest
from simple_cipher import Cipher from simple_cipher import (
Cipher,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from space_age import SpaceAge from space_age import (
SpaceAge,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from spiral_matrix import spiral_matrix from spiral_matrix import (
spiral_matrix,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,12 @@
import unittest import unittest
from sublist import sublist, SUBLIST, SUPERLIST, EQUAL, UNEQUAL from sublist import (
sublist,
SUBLIST,
SUPERLIST,
EQUAL,
UNEQUAL,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from sum_of_multiples import sum_of_multiples from sum_of_multiples import (
sum_of_multiples,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
@@ -52,7 +54,7 @@ class SumOfMultiplesTest(unittest.TestCase):
self.assertEqual(sum_of_multiples(4, [3, 0]), 3) self.assertEqual(sum_of_multiples(4, [3, 0]), 3)
def test_solutions_using_include_exclude_must_extend_to_cardinality_greater_than_3( def test_solutions_using_include_exclude_must_extend_to_cardinality_greater_than_3(
self self,
): ):
self.assertEqual(sum_of_multiples(10000, [2, 3, 5, 7, 11]), 39614537) self.assertEqual(sum_of_multiples(10000, [2, 3, 5, 7, 11]), 39614537)

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from tournament import tally from tournament import (
tally,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from transpose import transpose from transpose import (
transpose,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,10 @@
import unittest import unittest
from triangle import equilateral, isosceles, scalene from triangle import (
equilateral,
isosceles,
scalene,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from twelve_days import recite from twelve_days import (
recite,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

View File

@@ -1,38 +1,40 @@
import unittest import unittest
from two_bucket import measure from two_bucket import (
measure,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`
class TwoBucketTest(unittest.TestCase): class TwoBucketTest(unittest.TestCase):
def test_measure_using_bucket_one_of_size_3_and_bucket_two_of_size_5_start_with_bucket_one( def test_measure_using_bucket_one_of_size_3_and_bucket_two_of_size_5_start_with_bucket_one(
self self,
): ):
self.assertEqual(measure(3, 5, 1, "one"), (4, "one", 5)) self.assertEqual(measure(3, 5, 1, "one"), (4, "one", 5))
def test_measure_using_bucket_one_of_size_3_and_bucket_two_of_size_5_start_with_bucket_two( def test_measure_using_bucket_one_of_size_3_and_bucket_two_of_size_5_start_with_bucket_two(
self self,
): ):
self.assertEqual(measure(3, 5, 1, "two"), (8, "two", 3)) self.assertEqual(measure(3, 5, 1, "two"), (8, "two", 3))
def test_measure_using_bucket_one_of_size_7_and_bucket_two_of_size_11_start_with_bucket_one( def test_measure_using_bucket_one_of_size_7_and_bucket_two_of_size_11_start_with_bucket_one(
self self,
): ):
self.assertEqual(measure(7, 11, 2, "one"), (14, "one", 11)) self.assertEqual(measure(7, 11, 2, "one"), (14, "one", 11))
def test_measure_using_bucket_one_of_size_7_and_bucket_two_of_size_11_start_with_bucket_two( def test_measure_using_bucket_one_of_size_7_and_bucket_two_of_size_11_start_with_bucket_two(
self self,
): ):
self.assertEqual(measure(7, 11, 2, "two"), (18, "two", 7)) self.assertEqual(measure(7, 11, 2, "two"), (18, "two", 7))
def test_measure_one_step_using_bucket_one_of_size_1_and_bucket_two_of_size_3_start_with_bucket_two( def test_measure_one_step_using_bucket_one_of_size_1_and_bucket_two_of_size_3_start_with_bucket_two(
self self,
): ):
self.assertEqual(measure(1, 3, 3, "two"), (1, "two", 0)) self.assertEqual(measure(1, 3, 3, "two"), (1, "two", 0))
def test_measure_using_bucket_one_of_size_2_and_bucket_two_of_size_3_start_with_bucket_one_and_end_with_bucket_two( def test_measure_using_bucket_one_of_size_2_and_bucket_two_of_size_3_start_with_bucket_one_and_end_with_bucket_two(
self self,
): ):
self.assertEqual(measure(2, 3, 3, "one"), (2, "two", 2)) self.assertEqual(measure(2, 3, 3, "one"), (2, "two", 2))

View File

@@ -1,6 +1,8 @@
import unittest import unittest
from two_fer import two_fer from two_fer import (
two_fer,
)
# Tests adapted from `problem-specifications//canonical-data.json` # Tests adapted from `problem-specifications//canonical-data.json`

Some files were not shown because too many files have changed in this diff Show More