From e429369b5a0a5e519c57ed58cb5df5477ba1ad20 Mon Sep 17 00:00:00 2001 From: Corey McCandless Date: Sun, 31 Jan 2021 16:03:49 -0500 Subject: [PATCH 01/10] update bin/test-exercises.py for v3 structure changes --- .github/workflows/ci-workflow.yml | 2 +- bin/test-exercises.py | 65 +++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100755 bin/test-exercises.py diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index d1ccb4b3cc..44cc3ba0a2 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -71,4 +71,4 @@ jobs: # updates needed to tooling # - name: Check exercises # run: | - # ./test/check-exercises.py + # ./bin/test-exercises.py diff --git a/bin/test-exercises.py b/bin/test-exercises.py new file mode 100755 index 0000000000..7fd2b62d6f --- /dev/null +++ b/bin/test-exercises.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python3 + +import shutil +import subprocess +import sys +import tempfile +from pathlib import Path + +from data import Config, ExerciseInfo + +# Allow high-performance tests to be skipped +ALLOW_SKIP = ['alphametics', 'largest-series-product'] + + +def check_assignment(exercise: ExerciseInfo) -> int: + # Returns the exit code of the tests + workdir = Path(tempfile.mkdtemp(exercise.slug)) + solution_file = exercise.solution_stub.name + try: + test_file_out = workdir / exercise.test_file.name + if exercise.slug in ALLOW_SKIP: + shutil.copyfile(exercise.test_file, test_file_out) + else: + with exercise.test_file.open('r') as src_file: + lines = [line for line in src_file.readlines() + if not line.strip().startswith('@unittest.skip')] + with test_file_out.open('w') as dst_file: + dst_file.writelines(lines) + shutil.copyfile(exercise.exemplar_file, workdir / solution_file) + return subprocess.call([sys.executable, test_file_out]) + finally: + shutil.rmtree(workdir) + + +def main(): + config = Config.load() + exercises = config.exercises.all() + if len(sys.argv) >= 2: + # test specific exercises + exercises = [ + e for e in exercises if e.slug in sys.argv[1:] + ] + + failures = [] + for exercise in exercises: + print('# ', exercise.slug) + if not exercise.test_file: + print('FAIL: File with test cases not found') + failures.append('{} (FileNotFound)'.format(exercise.slug)) + else: + if check_assignment(exercise): + failures.append('{} (TestFailed)'.format(exercise)) + print('') + + print('TestEnvironment:', sys.executable.capitalize(), '\n\n') + + if failures: + print('FAILURES: ', ', '.join(failures)) + raise SystemExit(1) + else: + print('SUCCESS!') + + +if __name__ == '__main__': + main() From 7127656011f08f73685135f61c5255ce79e9fc74 Mon Sep 17 00:00:00 2001 From: Corey McCandless Date: Sun, 31 Jan 2021 16:06:16 -0500 Subject: [PATCH 02/10] move practice exercise example solutions to .meta/ --- bin/data.py | 165 ++++++++++++++++++ .../accumulate/{ => .meta}/example.py | 0 .../practice/acronym/{ => .meta}/example.py | 0 .../affine-cipher/{ => .meta}/example.py | 0 .../all-your-base/{ => .meta}/example.py | 0 .../practice/allergies/{ => .meta}/example.py | 0 .../alphametics/{ => .meta}/example.py | 0 .../practice/anagram/{ => .meta}/example.py | 0 .../armstrong-numbers/{ => .meta}/example.py | 0 .../atbash-cipher/{ => .meta}/example.py | 0 .../bank-account/{ => .meta}/example.py | 0 .../practice/beer-song/{ => .meta}/example.py | 0 .../binary-search-tree/{ => .meta}/example.py | 0 .../binary-search/{ => .meta}/example.py | 0 .../practice/binary/{ => .meta}/example.py | 0 exercises/practice/bob/{ => .meta}/example.py | 0 .../book-store/{ => .meta}/example.py | 2 +- .../practice/bowling/{ => .meta}/example.py | 0 .../practice/change/{ => .meta}/example.py | 0 .../circular-buffer/{ => .meta}/example.py | 0 .../practice/clock/{ => .meta}/example.py | 0 .../collatz-conjecture/{ => .meta}/example.py | 0 .../complex-numbers/{ => .meta}/example.py | 0 .../practice/connect/{ => .meta}/example.py | 0 .../crypto-square/{ => .meta}/example.py | 0 .../custom-set/{ => .meta}/example.py | 0 .../practice/darts/{ => .meta}/example.py | 0 .../practice/diamond/{ => .meta}/example.py | 0 .../{ => .meta}/example.py | 0 .../diffie-hellman/{ => .meta}/example.py | 0 .../dnd-character/{ => .meta}/example.py | 0 .../practice/dominoes/{ => .meta}/example.py | 0 .../practice/dot-dsl/{ => .meta}/example.py | 0 .../error-handling/{ => .meta}/example.py | 0 exercises/practice/etl/{ => .meta}/example.py | 0 .../flatten-array/{ => .meta}/example.py | 0 .../food-chain/{ => .meta}/example.py | 0 .../practice/forth/{ => .meta}/example.py | 0 .../gigasecond/{ => .meta}/example.py | 0 .../go-counting/{ => .meta}/example.py | 0 .../grade-school/{ => .meta}/example.py | 0 .../practice/grains/{ => .meta}/example.py | 0 .../practice/grep/{ => .meta}/example.py | 0 .../practice/hamming/{ => .meta}/example.py | 0 .../practice/hangman/{ => .meta}/example.py | 0 .../hello-world/{ => .meta}/example.py | 0 .../hexadecimal/{ => .meta}/example.py | 0 .../high-scores/{ => .meta}/example.py | 0 .../practice/house/{ => .meta}/example.py | 0 .../isbn-verifier/{ => .meta}/example.py | 0 .../practice/isogram/{ => .meta}/example.py | 0 .../{ => .meta}/example.py | 0 .../practice/knapsack/{ => .meta}/example.py | 0 .../{ => .meta}/example.py | 0 .../practice/leap/{ => .meta}/example.py | 0 .../practice/ledger/{ => .meta}/example.py | 0 .../linked-list/{ => .meta}/example.py | 0 .../practice/list-ops/{ => .meta}/example.py | 0 .../practice/luhn/{ => .meta}/example.py | 0 .../practice/markdown/{ => .meta}/example.py | 0 .../matching-brackets/{ => .meta}/example.py | 0 .../practice/matrix/{ => .meta}/example.py | 0 .../practice/meetup/{ => .meta}/example.py | 0 .../minesweeper/{ => .meta}/example.py | 0 .../practice/nth-prime/{ => .meta}/example.py | 0 .../nucleotide-count/{ => .meta}/example.py | 0 .../ocr-numbers/{ => .meta}/example.py | 0 .../practice/octal/{ => .meta}/example.py | 0 .../practice/paasio/{ => .meta}/example.py | 0 .../{ => .meta}/example.py | 0 .../practice/pangram/{ => .meta}/example.py | 0 .../{ => .meta}/example.py | 0 .../pascals-triangle/{ => .meta}/example.py | 0 .../perfect-numbers/{ => .meta}/example.py | 0 .../phone-number/{ => .meta}/example.py | 0 .../practice/pig-latin/{ => .meta}/example.py | 0 .../point-mutations/{ => .meta}/example.py | 0 .../practice/poker/{ => .meta}/example.py | 0 exercises/practice/pov/{ => .meta}/example.py | 0 .../prime-factors/{ => .meta}/example.py | 0 .../{ => .meta}/example.py | 0 .../practice/proverb/{ => .meta}/example.py | 0 .../{ => .meta}/example.py | 0 .../queen-attack/{ => .meta}/example.py | 0 .../rail-fence-cipher/{ => .meta}/example.py | 0 .../practice/raindrops/{ => .meta}/example.py | 2 +- .../rational-numbers/{ => .meta}/example.py | 0 .../practice/react/{ => .meta}/example.py | 0 .../rectangles/{ => .meta}/example.py | 0 .../resistor-color-duo/{ => .meta}/example.py | 0 .../resistor-color/{ => .meta}/example.py | 0 .../practice/rest-api/{ => .meta}/example.py | 0 .../reverse-string/{ => .meta}/example.py | 0 .../rna-transcription/{ => .meta}/example.py | 0 .../robot-name/{ => .meta}/example.py | 0 .../robot-simulator/{ => .meta}/example.py | 0 .../roman-numerals/{ => .meta}/example.py | 0 .../rotational-cipher/{ => .meta}/example.py | 0 .../{ => .meta}/example.py | 0 .../saddle-points/{ => .meta}/example.py | 0 .../practice/satellite/{ => .meta}/example.py | 0 exercises/practice/say/{ => .meta}/example.py | 0 .../scale-generator/{ => .meta}/example.py | 0 .../scrabble-score/{ => .meta}/example.py | 0 .../secret-handshake/{ => .meta}/example.py | 0 .../practice/series/{ => .meta}/example.py | 0 .../sgf-parsing/{ => .meta}/example.py | 0 .../practice/sieve/{ => .meta}/example.py | 0 .../simple-cipher/{ => .meta}/example.py | 0 .../simple-linked-list/{ => .meta}/example.py | 0 .../practice/space-age/{ => .meta}/example.py | 0 .../spiral-matrix/{ => .meta}/example.py | 0 .../practice/strain/{ => .meta}/example.py | 0 .../practice/sublist/{ => .meta}/example.py | 0 .../sum-of-multiples/{ => .meta}/example.py | 0 .../tournament/{ => .meta}/example.py | 0 .../practice/transpose/{ => .meta}/example.py | 0 .../tree-building/{ => .meta}/example.py | 0 .../practice/triangle/{ => .meta}/example.py | 0 .../practice/trinary/{ => .meta}/example.py | 0 .../twelve-days/{ => .meta}/example.py | 0 .../two-bucket/{ => .meta}/example.py | 0 .../practice/two-fer/{ => .meta}/example.py | 0 .../{ => .meta}/example.py | 0 .../word-count/{ => .meta}/example.py | 0 .../word-search/{ => .meta}/example.py | 0 .../practice/wordy/{ => .meta}/example.py | 0 .../practice/yacht/{ => .meta}/example.py | 0 .../zebra-puzzle/{ => .meta}/example.py | 0 .../practice/zipper/{ => .meta}/example.py | 0 test/check-exercises.py | 88 ---------- 131 files changed, 167 insertions(+), 90 deletions(-) create mode 100644 bin/data.py rename exercises/practice/accumulate/{ => .meta}/example.py (100%) rename exercises/practice/acronym/{ => .meta}/example.py (100%) rename exercises/practice/affine-cipher/{ => .meta}/example.py (100%) rename exercises/practice/all-your-base/{ => .meta}/example.py (100%) rename exercises/practice/allergies/{ => .meta}/example.py (100%) rename exercises/practice/alphametics/{ => .meta}/example.py (100%) rename exercises/practice/anagram/{ => .meta}/example.py (100%) rename exercises/practice/armstrong-numbers/{ => .meta}/example.py (100%) rename exercises/practice/atbash-cipher/{ => .meta}/example.py (100%) rename exercises/practice/bank-account/{ => .meta}/example.py (100%) rename exercises/practice/beer-song/{ => .meta}/example.py (100%) rename exercises/practice/binary-search-tree/{ => .meta}/example.py (100%) rename exercises/practice/binary-search/{ => .meta}/example.py (100%) rename exercises/practice/binary/{ => .meta}/example.py (100%) rename exercises/practice/bob/{ => .meta}/example.py (100%) rename exercises/practice/book-store/{ => .meta}/example.py (94%) rename exercises/practice/bowling/{ => .meta}/example.py (100%) rename exercises/practice/change/{ => .meta}/example.py (100%) rename exercises/practice/circular-buffer/{ => .meta}/example.py (100%) rename exercises/practice/clock/{ => .meta}/example.py (100%) rename exercises/practice/collatz-conjecture/{ => .meta}/example.py (100%) rename exercises/practice/complex-numbers/{ => .meta}/example.py (100%) rename exercises/practice/connect/{ => .meta}/example.py (100%) rename exercises/practice/crypto-square/{ => .meta}/example.py (100%) rename exercises/practice/custom-set/{ => .meta}/example.py (100%) rename exercises/practice/darts/{ => .meta}/example.py (100%) rename exercises/practice/diamond/{ => .meta}/example.py (100%) rename exercises/practice/difference-of-squares/{ => .meta}/example.py (100%) rename exercises/practice/diffie-hellman/{ => .meta}/example.py (100%) rename exercises/practice/dnd-character/{ => .meta}/example.py (100%) rename exercises/practice/dominoes/{ => .meta}/example.py (100%) rename exercises/practice/dot-dsl/{ => .meta}/example.py (100%) rename exercises/practice/error-handling/{ => .meta}/example.py (100%) rename exercises/practice/etl/{ => .meta}/example.py (100%) rename exercises/practice/flatten-array/{ => .meta}/example.py (100%) rename exercises/practice/food-chain/{ => .meta}/example.py (100%) rename exercises/practice/forth/{ => .meta}/example.py (100%) rename exercises/practice/gigasecond/{ => .meta}/example.py (100%) rename exercises/practice/go-counting/{ => .meta}/example.py (100%) rename exercises/practice/grade-school/{ => .meta}/example.py (100%) rename exercises/practice/grains/{ => .meta}/example.py (100%) rename exercises/practice/grep/{ => .meta}/example.py (100%) rename exercises/practice/hamming/{ => .meta}/example.py (100%) rename exercises/practice/hangman/{ => .meta}/example.py (100%) rename exercises/practice/hello-world/{ => .meta}/example.py (100%) rename exercises/practice/hexadecimal/{ => .meta}/example.py (100%) rename exercises/practice/high-scores/{ => .meta}/example.py (100%) rename exercises/practice/house/{ => .meta}/example.py (100%) rename exercises/practice/isbn-verifier/{ => .meta}/example.py (100%) rename exercises/practice/isogram/{ => .meta}/example.py (100%) rename exercises/practice/kindergarten-garden/{ => .meta}/example.py (100%) rename exercises/practice/knapsack/{ => .meta}/example.py (100%) rename exercises/practice/largest-series-product/{ => .meta}/example.py (100%) rename exercises/practice/leap/{ => .meta}/example.py (100%) rename exercises/practice/ledger/{ => .meta}/example.py (100%) rename exercises/practice/linked-list/{ => .meta}/example.py (100%) rename exercises/practice/list-ops/{ => .meta}/example.py (100%) rename exercises/practice/luhn/{ => .meta}/example.py (100%) rename exercises/practice/markdown/{ => .meta}/example.py (100%) rename exercises/practice/matching-brackets/{ => .meta}/example.py (100%) rename exercises/practice/matrix/{ => .meta}/example.py (100%) rename exercises/practice/meetup/{ => .meta}/example.py (100%) rename exercises/practice/minesweeper/{ => .meta}/example.py (100%) rename exercises/practice/nth-prime/{ => .meta}/example.py (100%) rename exercises/practice/nucleotide-count/{ => .meta}/example.py (100%) rename exercises/practice/ocr-numbers/{ => .meta}/example.py (100%) rename exercises/practice/octal/{ => .meta}/example.py (100%) rename exercises/practice/paasio/{ => .meta}/example.py (100%) rename exercises/practice/palindrome-products/{ => .meta}/example.py (100%) rename exercises/practice/pangram/{ => .meta}/example.py (100%) rename exercises/practice/parallel-letter-frequency/{ => .meta}/example.py (100%) rename exercises/practice/pascals-triangle/{ => .meta}/example.py (100%) rename exercises/practice/perfect-numbers/{ => .meta}/example.py (100%) rename exercises/practice/phone-number/{ => .meta}/example.py (100%) rename exercises/practice/pig-latin/{ => .meta}/example.py (100%) rename exercises/practice/point-mutations/{ => .meta}/example.py (100%) rename exercises/practice/poker/{ => .meta}/example.py (100%) rename exercises/practice/pov/{ => .meta}/example.py (100%) rename exercises/practice/prime-factors/{ => .meta}/example.py (100%) rename exercises/practice/protein-translation/{ => .meta}/example.py (100%) rename exercises/practice/proverb/{ => .meta}/example.py (100%) rename exercises/practice/pythagorean-triplet/{ => .meta}/example.py (100%) rename exercises/practice/queen-attack/{ => .meta}/example.py (100%) rename exercises/practice/rail-fence-cipher/{ => .meta}/example.py (100%) rename exercises/practice/raindrops/{ => .meta}/example.py (99%) rename exercises/practice/rational-numbers/{ => .meta}/example.py (100%) rename exercises/practice/react/{ => .meta}/example.py (100%) rename exercises/practice/rectangles/{ => .meta}/example.py (100%) rename exercises/practice/resistor-color-duo/{ => .meta}/example.py (100%) rename exercises/practice/resistor-color/{ => .meta}/example.py (100%) rename exercises/practice/rest-api/{ => .meta}/example.py (100%) rename exercises/practice/reverse-string/{ => .meta}/example.py (100%) rename exercises/practice/rna-transcription/{ => .meta}/example.py (100%) rename exercises/practice/robot-name/{ => .meta}/example.py (100%) rename exercises/practice/robot-simulator/{ => .meta}/example.py (100%) rename exercises/practice/roman-numerals/{ => .meta}/example.py (100%) rename exercises/practice/rotational-cipher/{ => .meta}/example.py (100%) rename exercises/practice/run-length-encoding/{ => .meta}/example.py (100%) rename exercises/practice/saddle-points/{ => .meta}/example.py (100%) rename exercises/practice/satellite/{ => .meta}/example.py (100%) rename exercises/practice/say/{ => .meta}/example.py (100%) rename exercises/practice/scale-generator/{ => .meta}/example.py (100%) rename exercises/practice/scrabble-score/{ => .meta}/example.py (100%) rename exercises/practice/secret-handshake/{ => .meta}/example.py (100%) rename exercises/practice/series/{ => .meta}/example.py (100%) rename exercises/practice/sgf-parsing/{ => .meta}/example.py (100%) rename exercises/practice/sieve/{ => .meta}/example.py (100%) rename exercises/practice/simple-cipher/{ => .meta}/example.py (100%) rename exercises/practice/simple-linked-list/{ => .meta}/example.py (100%) rename exercises/practice/space-age/{ => .meta}/example.py (100%) rename exercises/practice/spiral-matrix/{ => .meta}/example.py (100%) rename exercises/practice/strain/{ => .meta}/example.py (100%) rename exercises/practice/sublist/{ => .meta}/example.py (100%) rename exercises/practice/sum-of-multiples/{ => .meta}/example.py (100%) rename exercises/practice/tournament/{ => .meta}/example.py (100%) rename exercises/practice/transpose/{ => .meta}/example.py (100%) rename exercises/practice/tree-building/{ => .meta}/example.py (100%) rename exercises/practice/triangle/{ => .meta}/example.py (100%) rename exercises/practice/trinary/{ => .meta}/example.py (100%) rename exercises/practice/twelve-days/{ => .meta}/example.py (100%) rename exercises/practice/two-bucket/{ => .meta}/example.py (100%) rename exercises/practice/two-fer/{ => .meta}/example.py (100%) rename exercises/practice/variable-length-quantity/{ => .meta}/example.py (100%) rename exercises/practice/word-count/{ => .meta}/example.py (100%) rename exercises/practice/word-search/{ => .meta}/example.py (100%) rename exercises/practice/wordy/{ => .meta}/example.py (100%) rename exercises/practice/yacht/{ => .meta}/example.py (100%) rename exercises/practice/zebra-puzzle/{ => .meta}/example.py (100%) rename exercises/practice/zipper/{ => .meta}/example.py (100%) delete mode 100755 test/check-exercises.py diff --git a/bin/data.py b/bin/data.py new file mode 100644 index 0000000000..34d0e23b7e --- /dev/null +++ b/bin/data.py @@ -0,0 +1,165 @@ +from dataclasses import dataclass, asdict +import json +from pathlib import Path +from typing import List, Any + + +@dataclass +class TrackStatus: + concept_exercises: bool = False + test_runner: bool = False + representer: bool = False + analyzer: bool = False + + +@dataclass +class EditorSettings: + indent_style: str = 'space' + indent_size: int = 4 + + +@dataclass +class ExerciseInfo: + path: Path + slug: str + name: str + uuid: str + prerequisites: List[str] + type: str = 'practice' + deprecated: bool = False + + # concept only + concepts: List[str] = None + status: str = 'wip' + + # practice only + difficulty: int = 1 + topics: List[str] = None + practices: List[str] = None + + def __post_init__(self): + if self.concepts is None: + self.concepts = [] + if self.topics is None: + self.topics = [] + if self.practices is None: + self.practices = [] + + @property + def solution_stub(self): + return next(( + p for p in self.path.glob('*.py') + if not p.name.endswith('_test.py') and + p.name != 'example.py' + ), None) + + @property + def test_file(self): + return next(self.path.glob('*_test.py'), None) + + @property + def meta_dir(self): + return self.path / '.meta' + + @property + def exemplar_file(self): + if self.type == 'concept': + return self.meta_dir / 'exemplar.py' + # return self.meta_dir / 'example.py' + return self.path / 'example.py' + + @property + def template_path(self): + return self.meta_dir / '.template.j2' + + +@dataclass +class Exercises: + concept: List[ExerciseInfo] + practice: List[ExerciseInfo] + foregone: List[str] = None + + def __post_init__(self): + if self.foregone is None: + self.foregone = [] + for attr_name in ['concept', 'practice']: + base_path = Path('exercises') / attr_name + setattr( + self, + attr_name, + [ + ( + ExerciseInfo( + path=(base_path / e['slug']), + type=attr_name, + **e + ) if isinstance(e, dict) else e + ) + for e in getattr(self, attr_name) + ] + ) + + def all(self, include_deprecated=False): + _all = self.concept + self.practice + if not include_deprecated: + _all = [e for e in _all if not e.deprecated] + return _all + + +@dataclass +class Concept: + uuid: str + slug: str + name: str + blurb: str + + +@dataclass +class Config: + language: str + slug: str + active: bool + status: TrackStatus + blurb: str + version: int + online_editor: EditorSettings + exercises: Exercises + concepts: List[Concept] + key_features: List[Any] = None + tags: List[Any] = None + + def __post_init__(self): + if isinstance(self.status, dict): + self.status = TrackStatus(**self.status) + if isinstance(self.online_editor, dict): + self.online_editor = EditorSettings(**self.online_editor) + if isinstance(self.exercises, dict): + self.exercises = Exercises(**self.exercises) + self.concepts = [ + (Concept(**c) if isinstance(c, dict) else c) + for c in self.concepts + ] + if self.key_features is None: + self.key_features = [] + if self.tags is None: + self.tags = [] + + @classmethod + def load(cls, path='config.json'): + try: + with Path(path).open() as f: + return cls(**json.load(f)) + except IOError: + print(f'FAIL: {path} file not found') + raise SystemExit(1) + + +if __name__ == "__main__": + class CustomEncoder(json.JSONEncoder): + def default(self, obj): + if isinstance(obj, Path): + return str(obj) + return json.JSONEncoder.default(self, obj) + + config = Config.load() + print(json.dumps(asdict(config), cls=CustomEncoder, indent=2)) diff --git a/exercises/practice/accumulate/example.py b/exercises/practice/accumulate/.meta/example.py similarity index 100% rename from exercises/practice/accumulate/example.py rename to exercises/practice/accumulate/.meta/example.py diff --git a/exercises/practice/acronym/example.py b/exercises/practice/acronym/.meta/example.py similarity index 100% rename from exercises/practice/acronym/example.py rename to exercises/practice/acronym/.meta/example.py diff --git a/exercises/practice/affine-cipher/example.py b/exercises/practice/affine-cipher/.meta/example.py similarity index 100% rename from exercises/practice/affine-cipher/example.py rename to exercises/practice/affine-cipher/.meta/example.py diff --git a/exercises/practice/all-your-base/example.py b/exercises/practice/all-your-base/.meta/example.py similarity index 100% rename from exercises/practice/all-your-base/example.py rename to exercises/practice/all-your-base/.meta/example.py diff --git a/exercises/practice/allergies/example.py b/exercises/practice/allergies/.meta/example.py similarity index 100% rename from exercises/practice/allergies/example.py rename to exercises/practice/allergies/.meta/example.py diff --git a/exercises/practice/alphametics/example.py b/exercises/practice/alphametics/.meta/example.py similarity index 100% rename from exercises/practice/alphametics/example.py rename to exercises/practice/alphametics/.meta/example.py diff --git a/exercises/practice/anagram/example.py b/exercises/practice/anagram/.meta/example.py similarity index 100% rename from exercises/practice/anagram/example.py rename to exercises/practice/anagram/.meta/example.py diff --git a/exercises/practice/armstrong-numbers/example.py b/exercises/practice/armstrong-numbers/.meta/example.py similarity index 100% rename from exercises/practice/armstrong-numbers/example.py rename to exercises/practice/armstrong-numbers/.meta/example.py diff --git a/exercises/practice/atbash-cipher/example.py b/exercises/practice/atbash-cipher/.meta/example.py similarity index 100% rename from exercises/practice/atbash-cipher/example.py rename to exercises/practice/atbash-cipher/.meta/example.py diff --git a/exercises/practice/bank-account/example.py b/exercises/practice/bank-account/.meta/example.py similarity index 100% rename from exercises/practice/bank-account/example.py rename to exercises/practice/bank-account/.meta/example.py diff --git a/exercises/practice/beer-song/example.py b/exercises/practice/beer-song/.meta/example.py similarity index 100% rename from exercises/practice/beer-song/example.py rename to exercises/practice/beer-song/.meta/example.py diff --git a/exercises/practice/binary-search-tree/example.py b/exercises/practice/binary-search-tree/.meta/example.py similarity index 100% rename from exercises/practice/binary-search-tree/example.py rename to exercises/practice/binary-search-tree/.meta/example.py diff --git a/exercises/practice/binary-search/example.py b/exercises/practice/binary-search/.meta/example.py similarity index 100% rename from exercises/practice/binary-search/example.py rename to exercises/practice/binary-search/.meta/example.py diff --git a/exercises/practice/binary/example.py b/exercises/practice/binary/.meta/example.py similarity index 100% rename from exercises/practice/binary/example.py rename to exercises/practice/binary/.meta/example.py diff --git a/exercises/practice/bob/example.py b/exercises/practice/bob/.meta/example.py similarity index 100% rename from exercises/practice/bob/example.py rename to exercises/practice/bob/.meta/example.py diff --git a/exercises/practice/book-store/example.py b/exercises/practice/book-store/.meta/example.py similarity index 94% rename from exercises/practice/book-store/example.py rename to exercises/practice/book-store/.meta/example.py index c5e1b6f32c..dd197c0f71 100644 --- a/exercises/practice/book-store/example.py +++ b/exercises/practice/book-store/.meta/example.py @@ -23,4 +23,4 @@ def _total(books): def total(books): if not books: return 0 - return _total(sorted(books)) \ No newline at end of file + return _total(sorted(books)) diff --git a/exercises/practice/bowling/example.py b/exercises/practice/bowling/.meta/example.py similarity index 100% rename from exercises/practice/bowling/example.py rename to exercises/practice/bowling/.meta/example.py diff --git a/exercises/practice/change/example.py b/exercises/practice/change/.meta/example.py similarity index 100% rename from exercises/practice/change/example.py rename to exercises/practice/change/.meta/example.py diff --git a/exercises/practice/circular-buffer/example.py b/exercises/practice/circular-buffer/.meta/example.py similarity index 100% rename from exercises/practice/circular-buffer/example.py rename to exercises/practice/circular-buffer/.meta/example.py diff --git a/exercises/practice/clock/example.py b/exercises/practice/clock/.meta/example.py similarity index 100% rename from exercises/practice/clock/example.py rename to exercises/practice/clock/.meta/example.py diff --git a/exercises/practice/collatz-conjecture/example.py b/exercises/practice/collatz-conjecture/.meta/example.py similarity index 100% rename from exercises/practice/collatz-conjecture/example.py rename to exercises/practice/collatz-conjecture/.meta/example.py diff --git a/exercises/practice/complex-numbers/example.py b/exercises/practice/complex-numbers/.meta/example.py similarity index 100% rename from exercises/practice/complex-numbers/example.py rename to exercises/practice/complex-numbers/.meta/example.py diff --git a/exercises/practice/connect/example.py b/exercises/practice/connect/.meta/example.py similarity index 100% rename from exercises/practice/connect/example.py rename to exercises/practice/connect/.meta/example.py diff --git a/exercises/practice/crypto-square/example.py b/exercises/practice/crypto-square/.meta/example.py similarity index 100% rename from exercises/practice/crypto-square/example.py rename to exercises/practice/crypto-square/.meta/example.py diff --git a/exercises/practice/custom-set/example.py b/exercises/practice/custom-set/.meta/example.py similarity index 100% rename from exercises/practice/custom-set/example.py rename to exercises/practice/custom-set/.meta/example.py diff --git a/exercises/practice/darts/example.py b/exercises/practice/darts/.meta/example.py similarity index 100% rename from exercises/practice/darts/example.py rename to exercises/practice/darts/.meta/example.py diff --git a/exercises/practice/diamond/example.py b/exercises/practice/diamond/.meta/example.py similarity index 100% rename from exercises/practice/diamond/example.py rename to exercises/practice/diamond/.meta/example.py diff --git a/exercises/practice/difference-of-squares/example.py b/exercises/practice/difference-of-squares/.meta/example.py similarity index 100% rename from exercises/practice/difference-of-squares/example.py rename to exercises/practice/difference-of-squares/.meta/example.py diff --git a/exercises/practice/diffie-hellman/example.py b/exercises/practice/diffie-hellman/.meta/example.py similarity index 100% rename from exercises/practice/diffie-hellman/example.py rename to exercises/practice/diffie-hellman/.meta/example.py diff --git a/exercises/practice/dnd-character/example.py b/exercises/practice/dnd-character/.meta/example.py similarity index 100% rename from exercises/practice/dnd-character/example.py rename to exercises/practice/dnd-character/.meta/example.py diff --git a/exercises/practice/dominoes/example.py b/exercises/practice/dominoes/.meta/example.py similarity index 100% rename from exercises/practice/dominoes/example.py rename to exercises/practice/dominoes/.meta/example.py diff --git a/exercises/practice/dot-dsl/example.py b/exercises/practice/dot-dsl/.meta/example.py similarity index 100% rename from exercises/practice/dot-dsl/example.py rename to exercises/practice/dot-dsl/.meta/example.py diff --git a/exercises/practice/error-handling/example.py b/exercises/practice/error-handling/.meta/example.py similarity index 100% rename from exercises/practice/error-handling/example.py rename to exercises/practice/error-handling/.meta/example.py diff --git a/exercises/practice/etl/example.py b/exercises/practice/etl/.meta/example.py similarity index 100% rename from exercises/practice/etl/example.py rename to exercises/practice/etl/.meta/example.py diff --git a/exercises/practice/flatten-array/example.py b/exercises/practice/flatten-array/.meta/example.py similarity index 100% rename from exercises/practice/flatten-array/example.py rename to exercises/practice/flatten-array/.meta/example.py diff --git a/exercises/practice/food-chain/example.py b/exercises/practice/food-chain/.meta/example.py similarity index 100% rename from exercises/practice/food-chain/example.py rename to exercises/practice/food-chain/.meta/example.py diff --git a/exercises/practice/forth/example.py b/exercises/practice/forth/.meta/example.py similarity index 100% rename from exercises/practice/forth/example.py rename to exercises/practice/forth/.meta/example.py diff --git a/exercises/practice/gigasecond/example.py b/exercises/practice/gigasecond/.meta/example.py similarity index 100% rename from exercises/practice/gigasecond/example.py rename to exercises/practice/gigasecond/.meta/example.py diff --git a/exercises/practice/go-counting/example.py b/exercises/practice/go-counting/.meta/example.py similarity index 100% rename from exercises/practice/go-counting/example.py rename to exercises/practice/go-counting/.meta/example.py diff --git a/exercises/practice/grade-school/example.py b/exercises/practice/grade-school/.meta/example.py similarity index 100% rename from exercises/practice/grade-school/example.py rename to exercises/practice/grade-school/.meta/example.py diff --git a/exercises/practice/grains/example.py b/exercises/practice/grains/.meta/example.py similarity index 100% rename from exercises/practice/grains/example.py rename to exercises/practice/grains/.meta/example.py diff --git a/exercises/practice/grep/example.py b/exercises/practice/grep/.meta/example.py similarity index 100% rename from exercises/practice/grep/example.py rename to exercises/practice/grep/.meta/example.py diff --git a/exercises/practice/hamming/example.py b/exercises/practice/hamming/.meta/example.py similarity index 100% rename from exercises/practice/hamming/example.py rename to exercises/practice/hamming/.meta/example.py diff --git a/exercises/practice/hangman/example.py b/exercises/practice/hangman/.meta/example.py similarity index 100% rename from exercises/practice/hangman/example.py rename to exercises/practice/hangman/.meta/example.py diff --git a/exercises/practice/hello-world/example.py b/exercises/practice/hello-world/.meta/example.py similarity index 100% rename from exercises/practice/hello-world/example.py rename to exercises/practice/hello-world/.meta/example.py diff --git a/exercises/practice/hexadecimal/example.py b/exercises/practice/hexadecimal/.meta/example.py similarity index 100% rename from exercises/practice/hexadecimal/example.py rename to exercises/practice/hexadecimal/.meta/example.py diff --git a/exercises/practice/high-scores/example.py b/exercises/practice/high-scores/.meta/example.py similarity index 100% rename from exercises/practice/high-scores/example.py rename to exercises/practice/high-scores/.meta/example.py diff --git a/exercises/practice/house/example.py b/exercises/practice/house/.meta/example.py similarity index 100% rename from exercises/practice/house/example.py rename to exercises/practice/house/.meta/example.py diff --git a/exercises/practice/isbn-verifier/example.py b/exercises/practice/isbn-verifier/.meta/example.py similarity index 100% rename from exercises/practice/isbn-verifier/example.py rename to exercises/practice/isbn-verifier/.meta/example.py diff --git a/exercises/practice/isogram/example.py b/exercises/practice/isogram/.meta/example.py similarity index 100% rename from exercises/practice/isogram/example.py rename to exercises/practice/isogram/.meta/example.py diff --git a/exercises/practice/kindergarten-garden/example.py b/exercises/practice/kindergarten-garden/.meta/example.py similarity index 100% rename from exercises/practice/kindergarten-garden/example.py rename to exercises/practice/kindergarten-garden/.meta/example.py diff --git a/exercises/practice/knapsack/example.py b/exercises/practice/knapsack/.meta/example.py similarity index 100% rename from exercises/practice/knapsack/example.py rename to exercises/practice/knapsack/.meta/example.py diff --git a/exercises/practice/largest-series-product/example.py b/exercises/practice/largest-series-product/.meta/example.py similarity index 100% rename from exercises/practice/largest-series-product/example.py rename to exercises/practice/largest-series-product/.meta/example.py diff --git a/exercises/practice/leap/example.py b/exercises/practice/leap/.meta/example.py similarity index 100% rename from exercises/practice/leap/example.py rename to exercises/practice/leap/.meta/example.py diff --git a/exercises/practice/ledger/example.py b/exercises/practice/ledger/.meta/example.py similarity index 100% rename from exercises/practice/ledger/example.py rename to exercises/practice/ledger/.meta/example.py diff --git a/exercises/practice/linked-list/example.py b/exercises/practice/linked-list/.meta/example.py similarity index 100% rename from exercises/practice/linked-list/example.py rename to exercises/practice/linked-list/.meta/example.py diff --git a/exercises/practice/list-ops/example.py b/exercises/practice/list-ops/.meta/example.py similarity index 100% rename from exercises/practice/list-ops/example.py rename to exercises/practice/list-ops/.meta/example.py diff --git a/exercises/practice/luhn/example.py b/exercises/practice/luhn/.meta/example.py similarity index 100% rename from exercises/practice/luhn/example.py rename to exercises/practice/luhn/.meta/example.py diff --git a/exercises/practice/markdown/example.py b/exercises/practice/markdown/.meta/example.py similarity index 100% rename from exercises/practice/markdown/example.py rename to exercises/practice/markdown/.meta/example.py diff --git a/exercises/practice/matching-brackets/example.py b/exercises/practice/matching-brackets/.meta/example.py similarity index 100% rename from exercises/practice/matching-brackets/example.py rename to exercises/practice/matching-brackets/.meta/example.py diff --git a/exercises/practice/matrix/example.py b/exercises/practice/matrix/.meta/example.py similarity index 100% rename from exercises/practice/matrix/example.py rename to exercises/practice/matrix/.meta/example.py diff --git a/exercises/practice/meetup/example.py b/exercises/practice/meetup/.meta/example.py similarity index 100% rename from exercises/practice/meetup/example.py rename to exercises/practice/meetup/.meta/example.py diff --git a/exercises/practice/minesweeper/example.py b/exercises/practice/minesweeper/.meta/example.py similarity index 100% rename from exercises/practice/minesweeper/example.py rename to exercises/practice/minesweeper/.meta/example.py diff --git a/exercises/practice/nth-prime/example.py b/exercises/practice/nth-prime/.meta/example.py similarity index 100% rename from exercises/practice/nth-prime/example.py rename to exercises/practice/nth-prime/.meta/example.py diff --git a/exercises/practice/nucleotide-count/example.py b/exercises/practice/nucleotide-count/.meta/example.py similarity index 100% rename from exercises/practice/nucleotide-count/example.py rename to exercises/practice/nucleotide-count/.meta/example.py diff --git a/exercises/practice/ocr-numbers/example.py b/exercises/practice/ocr-numbers/.meta/example.py similarity index 100% rename from exercises/practice/ocr-numbers/example.py rename to exercises/practice/ocr-numbers/.meta/example.py diff --git a/exercises/practice/octal/example.py b/exercises/practice/octal/.meta/example.py similarity index 100% rename from exercises/practice/octal/example.py rename to exercises/practice/octal/.meta/example.py diff --git a/exercises/practice/paasio/example.py b/exercises/practice/paasio/.meta/example.py similarity index 100% rename from exercises/practice/paasio/example.py rename to exercises/practice/paasio/.meta/example.py diff --git a/exercises/practice/palindrome-products/example.py b/exercises/practice/palindrome-products/.meta/example.py similarity index 100% rename from exercises/practice/palindrome-products/example.py rename to exercises/practice/palindrome-products/.meta/example.py diff --git a/exercises/practice/pangram/example.py b/exercises/practice/pangram/.meta/example.py similarity index 100% rename from exercises/practice/pangram/example.py rename to exercises/practice/pangram/.meta/example.py diff --git a/exercises/practice/parallel-letter-frequency/example.py b/exercises/practice/parallel-letter-frequency/.meta/example.py similarity index 100% rename from exercises/practice/parallel-letter-frequency/example.py rename to exercises/practice/parallel-letter-frequency/.meta/example.py diff --git a/exercises/practice/pascals-triangle/example.py b/exercises/practice/pascals-triangle/.meta/example.py similarity index 100% rename from exercises/practice/pascals-triangle/example.py rename to exercises/practice/pascals-triangle/.meta/example.py diff --git a/exercises/practice/perfect-numbers/example.py b/exercises/practice/perfect-numbers/.meta/example.py similarity index 100% rename from exercises/practice/perfect-numbers/example.py rename to exercises/practice/perfect-numbers/.meta/example.py diff --git a/exercises/practice/phone-number/example.py b/exercises/practice/phone-number/.meta/example.py similarity index 100% rename from exercises/practice/phone-number/example.py rename to exercises/practice/phone-number/.meta/example.py diff --git a/exercises/practice/pig-latin/example.py b/exercises/practice/pig-latin/.meta/example.py similarity index 100% rename from exercises/practice/pig-latin/example.py rename to exercises/practice/pig-latin/.meta/example.py diff --git a/exercises/practice/point-mutations/example.py b/exercises/practice/point-mutations/.meta/example.py similarity index 100% rename from exercises/practice/point-mutations/example.py rename to exercises/practice/point-mutations/.meta/example.py diff --git a/exercises/practice/poker/example.py b/exercises/practice/poker/.meta/example.py similarity index 100% rename from exercises/practice/poker/example.py rename to exercises/practice/poker/.meta/example.py diff --git a/exercises/practice/pov/example.py b/exercises/practice/pov/.meta/example.py similarity index 100% rename from exercises/practice/pov/example.py rename to exercises/practice/pov/.meta/example.py diff --git a/exercises/practice/prime-factors/example.py b/exercises/practice/prime-factors/.meta/example.py similarity index 100% rename from exercises/practice/prime-factors/example.py rename to exercises/practice/prime-factors/.meta/example.py diff --git a/exercises/practice/protein-translation/example.py b/exercises/practice/protein-translation/.meta/example.py similarity index 100% rename from exercises/practice/protein-translation/example.py rename to exercises/practice/protein-translation/.meta/example.py diff --git a/exercises/practice/proverb/example.py b/exercises/practice/proverb/.meta/example.py similarity index 100% rename from exercises/practice/proverb/example.py rename to exercises/practice/proverb/.meta/example.py diff --git a/exercises/practice/pythagorean-triplet/example.py b/exercises/practice/pythagorean-triplet/.meta/example.py similarity index 100% rename from exercises/practice/pythagorean-triplet/example.py rename to exercises/practice/pythagorean-triplet/.meta/example.py diff --git a/exercises/practice/queen-attack/example.py b/exercises/practice/queen-attack/.meta/example.py similarity index 100% rename from exercises/practice/queen-attack/example.py rename to exercises/practice/queen-attack/.meta/example.py diff --git a/exercises/practice/rail-fence-cipher/example.py b/exercises/practice/rail-fence-cipher/.meta/example.py similarity index 100% rename from exercises/practice/rail-fence-cipher/example.py rename to exercises/practice/rail-fence-cipher/.meta/example.py diff --git a/exercises/practice/raindrops/example.py b/exercises/practice/raindrops/.meta/example.py similarity index 99% rename from exercises/practice/raindrops/example.py rename to exercises/practice/raindrops/.meta/example.py index 52f0f67712..97eeadc332 100644 --- a/exercises/practice/raindrops/example.py +++ b/exercises/practice/raindrops/.meta/example.py @@ -2,7 +2,7 @@ def convert(number): """ Converts a number to a string according to the raindrop sounds. """ - + result = '' if number % 3 == 0: result += 'Pling' diff --git a/exercises/practice/rational-numbers/example.py b/exercises/practice/rational-numbers/.meta/example.py similarity index 100% rename from exercises/practice/rational-numbers/example.py rename to exercises/practice/rational-numbers/.meta/example.py diff --git a/exercises/practice/react/example.py b/exercises/practice/react/.meta/example.py similarity index 100% rename from exercises/practice/react/example.py rename to exercises/practice/react/.meta/example.py diff --git a/exercises/practice/rectangles/example.py b/exercises/practice/rectangles/.meta/example.py similarity index 100% rename from exercises/practice/rectangles/example.py rename to exercises/practice/rectangles/.meta/example.py diff --git a/exercises/practice/resistor-color-duo/example.py b/exercises/practice/resistor-color-duo/.meta/example.py similarity index 100% rename from exercises/practice/resistor-color-duo/example.py rename to exercises/practice/resistor-color-duo/.meta/example.py diff --git a/exercises/practice/resistor-color/example.py b/exercises/practice/resistor-color/.meta/example.py similarity index 100% rename from exercises/practice/resistor-color/example.py rename to exercises/practice/resistor-color/.meta/example.py diff --git a/exercises/practice/rest-api/example.py b/exercises/practice/rest-api/.meta/example.py similarity index 100% rename from exercises/practice/rest-api/example.py rename to exercises/practice/rest-api/.meta/example.py diff --git a/exercises/practice/reverse-string/example.py b/exercises/practice/reverse-string/.meta/example.py similarity index 100% rename from exercises/practice/reverse-string/example.py rename to exercises/practice/reverse-string/.meta/example.py diff --git a/exercises/practice/rna-transcription/example.py b/exercises/practice/rna-transcription/.meta/example.py similarity index 100% rename from exercises/practice/rna-transcription/example.py rename to exercises/practice/rna-transcription/.meta/example.py diff --git a/exercises/practice/robot-name/example.py b/exercises/practice/robot-name/.meta/example.py similarity index 100% rename from exercises/practice/robot-name/example.py rename to exercises/practice/robot-name/.meta/example.py diff --git a/exercises/practice/robot-simulator/example.py b/exercises/practice/robot-simulator/.meta/example.py similarity index 100% rename from exercises/practice/robot-simulator/example.py rename to exercises/practice/robot-simulator/.meta/example.py diff --git a/exercises/practice/roman-numerals/example.py b/exercises/practice/roman-numerals/.meta/example.py similarity index 100% rename from exercises/practice/roman-numerals/example.py rename to exercises/practice/roman-numerals/.meta/example.py diff --git a/exercises/practice/rotational-cipher/example.py b/exercises/practice/rotational-cipher/.meta/example.py similarity index 100% rename from exercises/practice/rotational-cipher/example.py rename to exercises/practice/rotational-cipher/.meta/example.py diff --git a/exercises/practice/run-length-encoding/example.py b/exercises/practice/run-length-encoding/.meta/example.py similarity index 100% rename from exercises/practice/run-length-encoding/example.py rename to exercises/practice/run-length-encoding/.meta/example.py diff --git a/exercises/practice/saddle-points/example.py b/exercises/practice/saddle-points/.meta/example.py similarity index 100% rename from exercises/practice/saddle-points/example.py rename to exercises/practice/saddle-points/.meta/example.py diff --git a/exercises/practice/satellite/example.py b/exercises/practice/satellite/.meta/example.py similarity index 100% rename from exercises/practice/satellite/example.py rename to exercises/practice/satellite/.meta/example.py diff --git a/exercises/practice/say/example.py b/exercises/practice/say/.meta/example.py similarity index 100% rename from exercises/practice/say/example.py rename to exercises/practice/say/.meta/example.py diff --git a/exercises/practice/scale-generator/example.py b/exercises/practice/scale-generator/.meta/example.py similarity index 100% rename from exercises/practice/scale-generator/example.py rename to exercises/practice/scale-generator/.meta/example.py diff --git a/exercises/practice/scrabble-score/example.py b/exercises/practice/scrabble-score/.meta/example.py similarity index 100% rename from exercises/practice/scrabble-score/example.py rename to exercises/practice/scrabble-score/.meta/example.py diff --git a/exercises/practice/secret-handshake/example.py b/exercises/practice/secret-handshake/.meta/example.py similarity index 100% rename from exercises/practice/secret-handshake/example.py rename to exercises/practice/secret-handshake/.meta/example.py diff --git a/exercises/practice/series/example.py b/exercises/practice/series/.meta/example.py similarity index 100% rename from exercises/practice/series/example.py rename to exercises/practice/series/.meta/example.py diff --git a/exercises/practice/sgf-parsing/example.py b/exercises/practice/sgf-parsing/.meta/example.py similarity index 100% rename from exercises/practice/sgf-parsing/example.py rename to exercises/practice/sgf-parsing/.meta/example.py diff --git a/exercises/practice/sieve/example.py b/exercises/practice/sieve/.meta/example.py similarity index 100% rename from exercises/practice/sieve/example.py rename to exercises/practice/sieve/.meta/example.py diff --git a/exercises/practice/simple-cipher/example.py b/exercises/practice/simple-cipher/.meta/example.py similarity index 100% rename from exercises/practice/simple-cipher/example.py rename to exercises/practice/simple-cipher/.meta/example.py diff --git a/exercises/practice/simple-linked-list/example.py b/exercises/practice/simple-linked-list/.meta/example.py similarity index 100% rename from exercises/practice/simple-linked-list/example.py rename to exercises/practice/simple-linked-list/.meta/example.py diff --git a/exercises/practice/space-age/example.py b/exercises/practice/space-age/.meta/example.py similarity index 100% rename from exercises/practice/space-age/example.py rename to exercises/practice/space-age/.meta/example.py diff --git a/exercises/practice/spiral-matrix/example.py b/exercises/practice/spiral-matrix/.meta/example.py similarity index 100% rename from exercises/practice/spiral-matrix/example.py rename to exercises/practice/spiral-matrix/.meta/example.py diff --git a/exercises/practice/strain/example.py b/exercises/practice/strain/.meta/example.py similarity index 100% rename from exercises/practice/strain/example.py rename to exercises/practice/strain/.meta/example.py diff --git a/exercises/practice/sublist/example.py b/exercises/practice/sublist/.meta/example.py similarity index 100% rename from exercises/practice/sublist/example.py rename to exercises/practice/sublist/.meta/example.py diff --git a/exercises/practice/sum-of-multiples/example.py b/exercises/practice/sum-of-multiples/.meta/example.py similarity index 100% rename from exercises/practice/sum-of-multiples/example.py rename to exercises/practice/sum-of-multiples/.meta/example.py diff --git a/exercises/practice/tournament/example.py b/exercises/practice/tournament/.meta/example.py similarity index 100% rename from exercises/practice/tournament/example.py rename to exercises/practice/tournament/.meta/example.py diff --git a/exercises/practice/transpose/example.py b/exercises/practice/transpose/.meta/example.py similarity index 100% rename from exercises/practice/transpose/example.py rename to exercises/practice/transpose/.meta/example.py diff --git a/exercises/practice/tree-building/example.py b/exercises/practice/tree-building/.meta/example.py similarity index 100% rename from exercises/practice/tree-building/example.py rename to exercises/practice/tree-building/.meta/example.py diff --git a/exercises/practice/triangle/example.py b/exercises/practice/triangle/.meta/example.py similarity index 100% rename from exercises/practice/triangle/example.py rename to exercises/practice/triangle/.meta/example.py diff --git a/exercises/practice/trinary/example.py b/exercises/practice/trinary/.meta/example.py similarity index 100% rename from exercises/practice/trinary/example.py rename to exercises/practice/trinary/.meta/example.py diff --git a/exercises/practice/twelve-days/example.py b/exercises/practice/twelve-days/.meta/example.py similarity index 100% rename from exercises/practice/twelve-days/example.py rename to exercises/practice/twelve-days/.meta/example.py diff --git a/exercises/practice/two-bucket/example.py b/exercises/practice/two-bucket/.meta/example.py similarity index 100% rename from exercises/practice/two-bucket/example.py rename to exercises/practice/two-bucket/.meta/example.py diff --git a/exercises/practice/two-fer/example.py b/exercises/practice/two-fer/.meta/example.py similarity index 100% rename from exercises/practice/two-fer/example.py rename to exercises/practice/two-fer/.meta/example.py diff --git a/exercises/practice/variable-length-quantity/example.py b/exercises/practice/variable-length-quantity/.meta/example.py similarity index 100% rename from exercises/practice/variable-length-quantity/example.py rename to exercises/practice/variable-length-quantity/.meta/example.py diff --git a/exercises/practice/word-count/example.py b/exercises/practice/word-count/.meta/example.py similarity index 100% rename from exercises/practice/word-count/example.py rename to exercises/practice/word-count/.meta/example.py diff --git a/exercises/practice/word-search/example.py b/exercises/practice/word-search/.meta/example.py similarity index 100% rename from exercises/practice/word-search/example.py rename to exercises/practice/word-search/.meta/example.py diff --git a/exercises/practice/wordy/example.py b/exercises/practice/wordy/.meta/example.py similarity index 100% rename from exercises/practice/wordy/example.py rename to exercises/practice/wordy/.meta/example.py diff --git a/exercises/practice/yacht/example.py b/exercises/practice/yacht/.meta/example.py similarity index 100% rename from exercises/practice/yacht/example.py rename to exercises/practice/yacht/.meta/example.py diff --git a/exercises/practice/zebra-puzzle/example.py b/exercises/practice/zebra-puzzle/.meta/example.py similarity index 100% rename from exercises/practice/zebra-puzzle/example.py rename to exercises/practice/zebra-puzzle/.meta/example.py diff --git a/exercises/practice/zipper/example.py b/exercises/practice/zipper/.meta/example.py similarity index 100% rename from exercises/practice/zipper/example.py rename to exercises/practice/zipper/.meta/example.py diff --git a/test/check-exercises.py b/test/check-exercises.py deleted file mode 100755 index 0f924cda07..0000000000 --- a/test/check-exercises.py +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env python3 - -import shutil -import subprocess -import sys -import tempfile -import json -from pathlib import Path - -# Allow high-performance tests to be skipped -ALLOW_SKIP = ['alphametics', 'largest-series-product'] - - -def check_assignment(name: str, test_file: Path) -> int: - # Returns the exit code of the tests - workdir = Path(tempfile.mkdtemp(name)) - example_name = name.replace("-", "_") - try: - test_file_out = workdir / test_file.name - if name in ALLOW_SKIP: - shutil.copyfile(test_file, test_file_out) - else: - with test_file.open('r') as src_file: - lines = [line for line in src_file.readlines() - if not line.strip().startswith('@unittest.skip')] - with test_file_out.open('w') as dst_file: - dst_file.writelines(lines) - exemplar_file = test_file.with_name('exemplar.py') - if not exemplar_file.is_file(): - exemplar_file = exemplar_file.with_name('example.py') - print(exemplar_file) - shutil.copyfile(exemplar_file, workdir / f'{example_name}.py') - return subprocess.call([sys.executable, test_file_out]) - finally: - shutil.rmtree(workdir) - - -def load_config(): - config_file = Path('config.json') - try: - with config_file.open() as json_file: - data = json.load(json_file) - except IOError: - print(f'FAIL: {config_file} file not found') - raise SystemExit(1) - - try: - problems = [entry['slug'] for entry in data['exercises'] - if "deprecated" not in entry] - except KeyError: - print(f'FAIL: {config_file} has an incorrect format') - raise SystemExit(1) - - return problems - - -def main(): - if len(sys.argv) >= 2: - # test specific exercises - exercises = [exercise.strip('/') for exercise in sys.argv[1:]] - else: - # load exercises from config-file - exercises = load_config() - - failures = [] - exercises_dir = Path('exercises') - for exercise in exercises: - test_file = next((exercises_dir / exercise).glob('*_test.py'), None) - print('# ', exercise) - if not test_file: - print('FAIL: File with test cases not found') - failures.append('{} (FileNotFound)'.format(exercise)) - else: - if check_assignment(exercise, test_file): - failures.append('{} (TestFailed)'.format(exercise)) - print('') - - print('TestEnvironment:', sys.executable.capitalize(), '\n\n') - - if failures: - print('FAILURES: ', ', '.join(failures)) - raise SystemExit(1) - else: - print('SUCCESS!') - - -if __name__ == '__main__': - main() From da628c790ce2be45e398da2600910e4386352c46 Mon Sep 17 00:00:00 2001 From: Corey McCandless Date: Sun, 31 Jan 2021 16:08:33 -0500 Subject: [PATCH 03/10] re-enable exercise unit test check --- .github/workflows/ci-workflow.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 44cc3ba0a2..d4f5c3d65e 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -67,8 +67,6 @@ jobs: with: python-version: ${{ matrix.python-version }} - # TODO: cmccandless: directory and config.json structure changed in v3 migration, - # updates needed to tooling - # - name: Check exercises - # run: | - # ./bin/test-exercises.py + - name: Check exercises + run: | + ./bin/test-exercises.py From 0c73b59d29a8dfbc7a0f62601e2b372d8337c0b2 Mon Sep 17 00:00:00 2001 From: Corey McCandless Date: Sun, 31 Jan 2021 16:31:55 -0500 Subject: [PATCH 04/10] update template_status.py for v3 --- .github/workflows/ci-workflow.yml | 2 +- bin/data.py | 5 +- bin/template_status.py | 58 +++++++++----------- bin/{test-exercises.py => test_exercises.py} | 8 ++- 4 files changed, 36 insertions(+), 37 deletions(-) rename bin/{test-exercises.py => test_exercises.py} (86%) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index d4f5c3d65e..2b80a895fc 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -69,4 +69,4 @@ jobs: - name: Check exercises run: | - ./bin/test-exercises.py + ./bin/test_exercises.py diff --git a/bin/data.py b/bin/data.py index 34d0e23b7e..920ecda993 100644 --- a/bin/data.py +++ b/bin/data.py @@ -65,12 +65,11 @@ def meta_dir(self): def exemplar_file(self): if self.type == 'concept': return self.meta_dir / 'exemplar.py' - # return self.meta_dir / 'example.py' - return self.path / 'example.py' + return self.meta_dir / 'example.py' @property def template_path(self): - return self.meta_dir / '.template.j2' + return self.meta_dir / 'template.j2' @dataclass diff --git a/bin/template_status.py b/bin/template_status.py index 2d320bdd9a..1a67162594 100755 --- a/bin/template_status.py +++ b/bin/template_status.py @@ -4,12 +4,15 @@ from fnmatch import fnmatch import json import logging -import os +from pathlib import Path import shlex from subprocess import check_call, DEVNULL, CalledProcessError import sys -DEFAULT_SPEC_LOCATION = os.path.join("..", "problem-specifications") +from data import Config, ExerciseInfo +from test_exercises import check_assignment + +DEFAULT_SPEC_LOCATION = Path('spec') logging.basicConfig(format="%(levelname)s:%(message)s") logger = logging.getLogger("generator") @@ -26,16 +29,6 @@ def __lt__(self, other): return self.value < other.value -with open("config.json") as f: - config = json.load(f) - -exercises_dir = os.path.abspath("exercises") - - -def get_template_path(exercise): - return os.path.join(exercises_dir, exercise, ".meta", "template.j2") - - def exec_cmd(cmd): try: args = shlex.split(cmd) @@ -49,22 +42,20 @@ def exec_cmd(cmd): return False -def generate_template(exercise, spec_path): - script = os.path.abspath("bin/generate_tests.py") - return exec_cmd(f'{script} --verbose --spec-path "{spec_path}" {exercise}') +def generate_template(exercise: ExerciseInfo, spec_path: Path) -> bool: + script = Path('bin/generate_tests.py') + return exec_cmd(f'{script} --verbose --spec-path "{spec_path}" {exercise.slug}') -def run_tests(exercise): - script = os.path.abspath("test/check-exercises.py") - return exec_cmd(f"{script} {exercise}") +def run_tests(exercise: ExerciseInfo) -> bool: + return check_assignment(exercise, quiet=True) == 0 -def get_status(exercise, spec_path): - template_path = get_template_path(exercise) - if os.path.isfile(template_path): +def get_status(exercise: ExerciseInfo, spec_path: Path): + if exercise.template_path.is_file(): if generate_template(exercise, spec_path): if run_tests(exercise): - logging.info(f"{exercise}: OK") + logging.info(f"{exercise.slug}: OK") return TemplateStatus.OK else: return TemplateStatus.TEST_FAILURE @@ -84,6 +75,7 @@ def get_status(exercise, spec_path): "-p", "--spec-path", default=DEFAULT_SPEC_LOCATION, + type=Path, help=( "path to clone of exercism/problem-specifications " "(default: %(default)s)" ), @@ -96,10 +88,10 @@ def get_status(exercise, spec_path): elif opts.verbose >= 1: logger.setLevel(logging.INFO) - if not os.path.isdir(opts.spec_path): + if not opts.spec_path.is_dir(): logger.error(f"{opts.spec_path} is not a directory") sys.exit(1) - opts.spec_path = os.path.abspath(opts.spec_path) + opts.spec_path = opts.spec_path.absolute() logger.debug(f"problem-specifications path is {opts.spec_path}") result = True @@ -108,20 +100,24 @@ def get_status(exercise, spec_path): TemplateStatus.INVALID: [], TemplateStatus.TEST_FAILURE: [], } + config = Config.load() for exercise in filter( - lambda e: fnmatch(e["slug"], opts.exercise_pattern), config["exercises"] + lambda e: fnmatch(e.slug, opts.exercise_pattern), + config.exercises.all() ): - if exercise.get('deprecated', False): + if exercise.deprecated: + continue + if exercise.type == 'concept': + # Concept exercises are not generated continue - slug = exercise["slug"] - status = get_status(slug, opts.spec_path) + status = get_status(exercise, opts.spec_path) if status == TemplateStatus.OK: - logger.info(f"{slug}: {status.name}") + logger.info(f"{exercise.slug}: {status.name}") else: - buckets[status].append(slug) + buckets[status].append(exercise.slug) result = False if opts.stop_on_failure: - logger.error(f"{slug}: {status.name}") + logger.error(f"{exercise.slug}: {status.name}") break if not opts.quiet and not opts.stop_on_failure: diff --git a/bin/test-exercises.py b/bin/test_exercises.py similarity index 86% rename from bin/test-exercises.py rename to bin/test_exercises.py index 7fd2b62d6f..6137a0034c 100755 --- a/bin/test-exercises.py +++ b/bin/test_exercises.py @@ -12,7 +12,7 @@ ALLOW_SKIP = ['alphametics', 'largest-series-product'] -def check_assignment(exercise: ExerciseInfo) -> int: +def check_assignment(exercise: ExerciseInfo, quiet=False) -> int: # Returns the exit code of the tests workdir = Path(tempfile.mkdtemp(exercise.slug)) solution_file = exercise.solution_stub.name @@ -27,7 +27,11 @@ def check_assignment(exercise: ExerciseInfo) -> int: with test_file_out.open('w') as dst_file: dst_file.writelines(lines) shutil.copyfile(exercise.exemplar_file, workdir / solution_file) - return subprocess.call([sys.executable, test_file_out]) + kwargs = {} + if quiet: + kwargs['stdout'] = subprocess.DEVNULL + kwargs['stderr'] = subprocess.DEVNULL + return subprocess.run([sys.executable, test_file_out], **kwargs).returncode finally: shutil.rmtree(workdir) From 383672e03aa2c328bdc2b1d384fc8d8ec622d1c7 Mon Sep 17 00:00:00 2001 From: Corey McCandless Date: Sun, 31 Jan 2021 16:41:22 -0500 Subject: [PATCH 05/10] update generate_tests.py for v3 --- bin/generate_tests.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/generate_tests.py b/bin/generate_tests.py index 7bcc64b180..d98216bb54 100755 --- a/bin/generate_tests.py +++ b/bin/generate_tests.py @@ -194,11 +194,11 @@ def regex_split(s: str, find: str) -> List[str]: return re.split(find, s) -def load_tests_toml(exercise: str) -> Dict[str, bool]: +def load_tests_toml(exercise: Path) -> Dict[str, bool]: """ Loads test case opt-in/out data for an exercise as a dictionary """ - full_path = Path("exercises") / exercise / ".meta/tests.toml" + full_path = exercise / ".meta/tests.toml" with full_path.open() as f: opts = toml.load(f) return opts @@ -238,11 +238,11 @@ def load_canonical(exercise: str, spec_path: Path, test_opts: Dict[str, bool]) - return spec -def load_additional_tests(exercise: str) -> List[TypeJSON]: +def load_additional_tests(exercise: Path) -> List[TypeJSON]: """ Loads additional tests from .meta/additional_tests.json """ - full_path = Path("exercises") / exercise / ".meta/additional_tests.json" + full_path = exercise / ".meta/additional_tests.json" try: with full_path.open() as f: data = json.load(f) @@ -295,14 +295,14 @@ def generate_exercise(env: Environment, spec_path: Path, exercise: Path, check: sys.modules[plugins_name] = plugins_module plugins_spec.loader.exec_module(plugins_module) try: - test_opts = load_tests_toml(slug) + test_opts = load_tests_toml(exercise) except FileNotFoundError: logger.error(f"{slug}: tests.toml not found; please run canonical_data_syncer") return False spec = load_canonical(slug, spec_path, test_opts) - additional_tests = load_additional_tests(slug) + additional_tests = load_additional_tests(exercise) spec["additional_cases"] = additional_tests - template_path = Path(slug) / ".meta" / "template.j2" + template_path = exercise.relative_to("exercises") / ".meta/template.j2" template = env.get_template(str(template_path)) tests_path = exercise / f"{to_snake(slug)}_test.py" spec["has_error_case"] = has_error_case(spec["cases"]) @@ -399,7 +399,7 @@ def generate( env.filters["escape_invalid_escapes"] = escape_invalid_escapes env.tests["error_case"] = error_case result = True - for exercise in sorted(Path("exercises").glob(exercise_glob)): + for exercise in sorted(Path("exercises/practice").glob(exercise_glob)): if not generate_exercise(env, spec_path, exercise, check): result = False if stop_on_failure: From 69780e161f7a3121bdb3a5f01a881b7de39604fc Mon Sep 17 00:00:00 2001 From: Corey McCandless Date: Sun, 31 Jan 2021 16:43:06 -0500 Subject: [PATCH 06/10] Remove bin/check-test-version.py; superseded by canonical_data_syncer --- bin/check-test-version.py | 331 -------------------------------------- 1 file changed, 331 deletions(-) delete mode 100755 bin/check-test-version.py diff --git a/bin/check-test-version.py b/bin/check-test-version.py deleted file mode 100755 index 6105a3e265..0000000000 --- a/bin/check-test-version.py +++ /dev/null @@ -1,331 +0,0 @@ -#!/usr/bin/env python -from __future__ import print_function - -import argparse -import json -import os -import re -import sys -from glob import glob - -from create_issue import GitHub - -if sys.version_info[0] == 3: - FileNotFoundError = OSError -else: - FileNotFoundError = IOError - -VERSION_PATTERN = r'(\d+\.\d+\.\d+)' -CANONICAL_PATTERN = ( - '# Tests adapted from `?problem-specifications//canonical-data.json`? ' - '@ v' + VERSION_PATTERN -) -rgx_version = re.compile(VERSION_PATTERN) -rgx_canonical = re.compile(CANONICAL_PATTERN) -DEFAULT_SPEC_PATH = os.path.join( - '..', - 'problem-specifications' -) -gh = None - -with open('config.json') as f: - config = json.load(f) - - -class CustomFormatter( - argparse.ArgumentDefaultsHelpFormatter, - argparse.RawDescriptionHelpFormatter -): - pass - - -class bcolors: - HEADER = '\033[95m' - OKBLUE = '\033[94m' - OKGREEN = '\033[92m' - WARNING = '\033[93m' - FAIL = '\033[91m' - ENDC = '\033[0m' - BOLD = '\033[1m' - UNDERLINE = '\033[4m' - - -def cjust(string, width, fillchar=' '): - while len(string) < width: - string = fillchar + string - if len(string) >= width: - break - string += fillchar - return string - - -def verify_spec_location(path): - with open(os.path.join(path, 'package.json')) as f: - data = json.load(f) - if data['name'] != 'problem-specifications': - raise ValueError( - '{} is not the problem-specifications directory'.format(path) - ) - - -def get_test_file_path(exercise): - return os.path.join( - 'exercises', - exercise, - exercise.replace('-', '_') + '_test.py' - ) - - -def get_test_file_url(exercise): - return '/'.join([ - 'https://github.com', - 'exercism', - 'python', - 'blob', - 'master', - 'exercises', - exercise, - exercise.replace('-', '_') + '_test.py' - ]) - - -def get_canonical_data_path(exercise, spec_path=DEFAULT_SPEC_PATH): - return os.path.join( - spec_path, - 'exercises', - exercise, - 'canonical-data.json' - ) - - -def get_canonical_data_url(exercise): - return '/'.join([ - 'https://github.com', - 'exercism', - 'problem-specifications', - 'blob', - 'master', - 'exercises', - exercise, - 'canonical-data.json' - ]) - - -def get_referenced_version(exercise): - with open(get_test_file_path(exercise)) as f: - for line in f.readlines(): - m = rgx_canonical.match(line) - if m is not None: - return m.group(1) - return '0.0.0' - - -def get_available_version(exercise, spec_path=DEFAULT_SPEC_PATH): - try: - with open(get_canonical_data_path(exercise, spec_path)) as f: - data = json.load(f) - m = rgx_version.match(data['version']) - return m.group(1) - except FileNotFoundError: - return '0.0.0' - - -def is_deprecated(exercise): - for e in config['exercises']: - if e['slug'] == exercise: - return e.get('deprecated', False) - return False - - -def create_issue_for_exercise( - exercise, - available_data_version, - extra_labels=None -): - title = '{}: update tests to v{}'.format(exercise, available_data_version) - body = ( - 'The [test suite]({}) for {} is out of date and needs updated to ' - 'conform to the [latest canonical data]({}).' - ).format( - get_test_file_url(exercise), - exercise, - get_canonical_data_url(exercise), - ) - labels = [ - 'beginner friendly', - 'help wanted', - 'enhancement', - ] - if extra_labels is not None: - labels = list(set(labels + extra_labels)) - issue = gh.create_issue( - 'exercism', - 'python', - title, - body=body, - labels=labels - ) - return issue['number'] - - -def check_test_version( - exercise, - spec=DEFAULT_SPEC_PATH, - no_color=True, - print_ok=True, - name_only=False, - has_data=False, - include_deprecated=False, - create_issue=False, - token=None, - extra_labels=None, -): - if not include_deprecated and is_deprecated(exercise): - return True - available = get_available_version(exercise, spec) - if available == '0.0.0' and has_data: - return True - referenced = get_referenced_version(exercise) - up_to_date = available == referenced - if up_to_date: - status, status_color = 'OK', bcolors.OKGREEN - else: - status, status_color = 'NOT OK', bcolors.FAIL - status = cjust(status, 8) - if not no_color: - status = status_color + status + bcolors.ENDC - if not up_to_date or print_ok: - if create_issue: - issue_number = create_issue_for_exercise( - exercise, - available, - extra_labels - ) - issue_info = '(#{})'.format(issue_number) - else: - issue_info = '' - if name_only: - baseline = exercise - else: - baseline = '[{}] {}: {}{}{}'.format( - status, - exercise, - referenced, - '=' if up_to_date else '!=', - available - ) - print(' '.join((baseline, issue_info))) - return up_to_date - - -if __name__ == '__main__': - parser = argparse.ArgumentParser( - formatter_class=CustomFormatter, - epilog=( - "Results are of the form:\n : !=" - ) - ) - parser._optionals.title = 'options' - parser.add_argument( - '--version', - action='store_true', - help='Print version info.' - ) - parser.add_argument( - '-o', '--only', - default='*', - metavar='', - help='Check just the exercise specified (by the slug).', - ) - parser.add_argument( - '--ignore', - action='append', - help='Check all except exercise[s] specified (by the slug).', - ) - parser.add_argument( - '-p', '--spec-path', - default=DEFAULT_SPEC_PATH, - metavar='', - help='The location of the problem-specifications directory.' - ) - g = parser.add_argument_group('output') - g.add_argument( - '-w', '--no-color', - action='store_true', - help='Disable colored output.' - ) - g.add_argument( - '-s', '--has-data', - action='store_true', - help='Only print exercises with existing canonical data.' - ) - g.add_argument( - '-d', '--include-deprecated', - action='store_true', - help='Include deprecated exercises' - ) - mut_g = g.add_mutually_exclusive_group() - mut_g.add_argument( - '-v', '--verbose', - action='store_true', - help='Enable verbose output.' - ) - mut_g.add_argument( - '-n', '--name-only', - action='store_true', - help='Print exercise names only.' - ) - g = parser.add_argument_group('issue creation') - g.add_argument( - '--create-issue', - action='store_true', - help='Create issue for out-of-date exercises' - ) - g.add_argument( - '-t', '--token', - help='GitHub personal access token (permissions: repo)' - ) - g.add_argument( - '--labels', - nargs='+', - metavar='LABEL', - help=( - 'additional issue labels ("beginner friendly", "enhancement", and ' - '"help wanted" are always set)' - ) - ) - opts = parser.parse_args() - verify_spec_location(opts.spec_path) - if opts.create_issue: - if opts.token is None: - if os.path.isfile('.github.api_token'): - with open('.github.api_token') as f: - opts.token = f.read().strip() - if opts.token is not None: - gh = GitHub(api_token=opts.token) - else: - gh = GitHub() - kwargs = dict( - spec=opts.spec_path, - no_color=opts.no_color, - print_ok=opts.verbose, - name_only=opts.name_only, - has_data=opts.has_data, - create_issue=opts.create_issue, - extra_labels=opts.labels, - ) - if opts.version: - print('check-test-version.py v1.1') - sys.exit(0) - result = True - for exercise in glob(os.path.join('exercises', opts.only)): - exercise = exercise.split(os.path.sep)[-1] - if opts.ignore and exercise in opts.ignore: - continue - if os.path.isdir(os.path.join('exercises', exercise)): - try: - result = check_test_version(exercise, **kwargs) and result - except FileNotFoundError as e: - print(str(e)) - result = False - sys.exit(0 if result else 1) From db7ed7791b0bb13137e077b46667912bbabb2cc9 Mon Sep 17 00:00:00 2001 From: Corey McCandless Date: Sun, 31 Jan 2021 16:44:32 -0500 Subject: [PATCH 07/10] re-enable disabled checks --- .github/workflows/ci-workflow.yml | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 2b80a895fc..8a6e5c410e 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -28,13 +28,13 @@ jobs: git clone https://github.com/exercism/problem-specifications spec pip install -r requirements-generator.txt - - name: Check readmes - run: | - ./bin/check-readmes.sh + # - name: Check readmes + # run: | + # ./bin/check-readmes.sh - #- name: Generate tests - # run: | - # bin/generate_tests.py --verbose -p spec --check + - name: Generate tests + run: | + bin/generate_tests.py --verbose -p spec --check - name: Lint with flake8 run: | @@ -43,16 +43,10 @@ jobs: # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - #- name: Test version status - # run: | - # ./bin/check-test-version.py -p spec - - # TODO: cmccandless: directory and config.json structure changed in v3 migration, - # updates needed to tooling - # - name: Test template status - # continue-on-error: true - # run: | - # ./bin/template_status.py -v -p spec + - name: Test template status + continue-on-error: true + run: | + ./bin/template_status.py -v -p spec canonical_sync: runs-on: ubuntu-16.04 From cfd2573ced74f2e2e299f6d92316e8503488fead Mon Sep 17 00:00:00 2001 From: Corey McCandless Date: Sun, 31 Jan 2021 16:49:12 -0500 Subject: [PATCH 08/10] use python3.8 in CI and run test generator --- .github/workflows/ci-workflow.yml | 4 +-- exercises/practice/acronym/acronym_test.py | 4 ++- .../affine-cipher/affine_cipher_test.py | 5 +++- .../all-your-base/all_your_base_test.py | 4 ++- .../practice/allergies/allergies_test.py | 4 ++- .../practice/alphametics/alphametics_test.py | 4 ++- exercises/practice/anagram/anagram_test.py | 4 ++- .../armstrong_numbers_test.py | 4 ++- .../atbash-cipher/atbash_cipher_test.py | 5 +++- .../practice/beer-song/beer_song_test.py | 4 ++- .../binary_search_tree_test.py | 5 +++- .../binary-search/binary_search_test.py | 4 ++- exercises/practice/bob/bob_test.py | 4 ++- .../practice/book-store/book_store_test.py | 6 +++-- exercises/practice/bowling/bowling_test.py | 26 ++++++++++--------- exercises/practice/change/change_test.py | 4 ++- .../circular-buffer/circular_buffer_test.py | 6 +++-- exercises/practice/clock/clock_test.py | 4 ++- .../collatz_conjecture_test.py | 4 ++- .../complex-numbers/complex_numbers_test.py | 8 +++--- exercises/practice/connect/connect_test.py | 4 ++- .../crypto-square/crypto_square_test.py | 8 +++--- .../practice/custom-set/custom_set_test.py | 8 +++--- exercises/practice/darts/darts_test.py | 4 ++- exercises/practice/diamond/diamond_test.py | 4 ++- .../difference_of_squares_test.py | 6 ++++- .../diffie-hellman/diffie_hellman_test.py | 24 ++++++++++++++--- .../dnd-character/dnd_character_test.py | 5 +++- exercises/practice/dominoes/dominoes_test.py | 4 ++- exercises/practice/etl/etl_test.py | 4 ++- .../flatten-array/flatten_array_test.py | 4 ++- .../practice/food-chain/food_chain_test.py | 4 ++- exercises/practice/forth/forth_test.py | 5 +++- .../practice/gigasecond/gigasecond_test.py | 4 ++- .../practice/go-counting/go_counting_test.py | 7 ++++- .../grade-school/grade_school_test.py | 8 +++--- exercises/practice/grains/grains_test.py | 19 ++++++++------ exercises/practice/grep/grep_test.py | 4 ++- exercises/practice/hamming/hamming_test.py | 4 ++- .../practice/hello-world/hello_world_test.py | 4 ++- .../practice/high-scores/high_scores_test.py | 6 ++++- exercises/practice/house/house_test.py | 4 ++- .../isbn-verifier/isbn_verifier_test.py | 4 ++- exercises/practice/isogram/isogram_test.py | 4 ++- .../kindergarten_garden_test.py | 12 +++++---- exercises/practice/knapsack/knapsack_test.py | 4 ++- .../largest_series_product_test.py | 4 ++- exercises/practice/leap/leap_test.py | 6 +++-- exercises/practice/luhn/luhn_test.py | 4 ++- exercises/practice/markdown/markdown_test.py | 10 ++++--- .../matching_brackets_test.py | 4 ++- exercises/practice/matrix/matrix_test.py | 4 ++- exercises/practice/meetup/meetup_test.py | 5 +++- .../practice/minesweeper/minesweeper_test.py | 4 ++- .../practice/nth-prime/nth_prime_test.py | 4 ++- .../practice/ocr-numbers/ocr_numbers_test.py | 10 ++++--- .../palindrome_products_test.py | 5 +++- exercises/practice/pangram/pangram_test.py | 4 ++- .../perfect-numbers/perfect_numbers_test.py | 4 ++- .../phone-number/phone_number_test.py | 4 ++- .../practice/pig-latin/pig_latin_test.py | 4 ++- exercises/practice/poker/poker_test.py | 20 +++++++------- exercises/practice/pov/pov_test.py | 4 ++- .../prime-factors/prime_factors_test.py | 4 ++- .../protein_translation_test.py | 4 ++- .../pythagorean_triplet_test.py | 4 ++- .../queen-attack/queen_attack_test.py | 6 +++-- .../rail_fence_cipher_test.py | 5 +++- .../practice/raindrops/raindrops_test.py | 6 +++-- .../rational-numbers/rational_numbers_test.py | 8 +++--- .../practice/rectangles/rectangles_test.py | 4 ++- .../resistor_color_duo_test.py | 4 ++- .../resistor-color/resistor_color_test.py | 5 +++- exercises/practice/rest-api/rest_api_test.py | 4 ++- .../reverse-string/reverse_string_test.py | 4 ++- .../rna_transcription_test.py | 4 ++- .../robot-simulator/robot_simulator_test.py | 8 +++++- .../roman-numerals/roman_numerals_test.py | 4 ++- .../rotational_cipher_test.py | 4 ++- .../run_length_encoding_test.py | 5 +++- .../saddle-points/saddle_points_test.py | 8 +++--- .../practice/satellite/satellite_test.py | 4 ++- exercises/practice/say/say_test.py | 4 ++- .../scale-generator/scale_generator_test.py | 4 ++- .../scrabble-score/scrabble_score_test.py | 4 ++- .../secret-handshake/secret_handshake_test.py | 4 ++- exercises/practice/series/series_test.py | 4 ++- .../practice/sgf-parsing/sgf_parsing_test.py | 5 +++- exercises/practice/sieve/sieve_test.py | 4 ++- .../simple-cipher/simple_cipher_test.py | 4 ++- .../practice/space-age/space_age_test.py | 4 ++- .../spiral-matrix/spiral_matrix_test.py | 4 ++- exercises/practice/sublist/sublist_test.py | 8 +++++- .../sum-of-multiples/sum_of_multiples_test.py | 6 +++-- .../practice/tournament/tournament_test.py | 4 ++- .../practice/transpose/transpose_test.py | 4 ++- exercises/practice/triangle/triangle_test.py | 6 ++++- .../practice/twelve-days/twelve_days_test.py | 4 ++- .../practice/two-bucket/two_bucket_test.py | 16 +++++++----- exercises/practice/two-fer/two_fer_test.py | 4 ++- .../variable_length_quantity_test.py | 5 +++- .../practice/word-count/word_count_test.py | 4 ++- .../practice/word-search/word_search_test.py | 13 ++++++---- exercises/practice/wordy/wordy_test.py | 4 ++- .../zebra-puzzle/zebra_puzzle_test.py | 5 +++- exercises/practice/zipper/zipper_test.py | 4 ++- requirements-generator.txt | 2 +- 107 files changed, 432 insertions(+), 174 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 8a6e5c410e..dbe5ffa174 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -16,10 +16,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up Python 3.7 + - name: Set up Python uses: actions/setup-python@v2.2.1 with: - python-version: 3.7 + python-version: 3.8 - name: Download & Install dependencies run: | diff --git a/exercises/practice/acronym/acronym_test.py b/exercises/practice/acronym/acronym_test.py index 685cf30636..c5fbbfa39e 100644 --- a/exercises/practice/acronym/acronym_test.py +++ b/exercises/practice/acronym/acronym_test.py @@ -1,6 +1,8 @@ import unittest -from acronym import abbreviate +from acronym import ( + abbreviate, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/affine-cipher/affine_cipher_test.py b/exercises/practice/affine-cipher/affine_cipher_test.py index fe87d47a0c..4e9ca0b2b4 100644 --- a/exercises/practice/affine-cipher/affine_cipher_test.py +++ b/exercises/practice/affine-cipher/affine_cipher_test.py @@ -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` diff --git a/exercises/practice/all-your-base/all_your_base_test.py b/exercises/practice/all-your-base/all_your_base_test.py index 5779b928ac..a308261f40 100644 --- a/exercises/practice/all-your-base/all_your_base_test.py +++ b/exercises/practice/all-your-base/all_your_base_test.py @@ -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` diff --git a/exercises/practice/allergies/allergies_test.py b/exercises/practice/allergies/allergies_test.py index bf1cd3bb1c..7529fc86ba 100644 --- a/exercises/practice/allergies/allergies_test.py +++ b/exercises/practice/allergies/allergies_test.py @@ -1,6 +1,8 @@ import unittest -from allergies import Allergies +from allergies import ( + Allergies, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/alphametics/alphametics_test.py b/exercises/practice/alphametics/alphametics_test.py index e9ec14a440..c1f573391b 100644 --- a/exercises/practice/alphametics/alphametics_test.py +++ b/exercises/practice/alphametics/alphametics_test.py @@ -1,6 +1,8 @@ import unittest -from alphametics import solve +from alphametics import ( + solve, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/anagram/anagram_test.py b/exercises/practice/anagram/anagram_test.py index 644182b6f6..241a6f4bfa 100644 --- a/exercises/practice/anagram/anagram_test.py +++ b/exercises/practice/anagram/anagram_test.py @@ -1,6 +1,8 @@ import unittest -from anagram import find_anagrams +from anagram import ( + find_anagrams, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/armstrong-numbers/armstrong_numbers_test.py b/exercises/practice/armstrong-numbers/armstrong_numbers_test.py index 01203b6976..a17beccae2 100644 --- a/exercises/practice/armstrong-numbers/armstrong_numbers_test.py +++ b/exercises/practice/armstrong-numbers/armstrong_numbers_test.py @@ -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` diff --git a/exercises/practice/atbash-cipher/atbash_cipher_test.py b/exercises/practice/atbash-cipher/atbash_cipher_test.py index 237ff262e9..98c1072afc 100644 --- a/exercises/practice/atbash-cipher/atbash_cipher_test.py +++ b/exercises/practice/atbash-cipher/atbash_cipher_test.py @@ -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` diff --git a/exercises/practice/beer-song/beer_song_test.py b/exercises/practice/beer-song/beer_song_test.py index 606092d2e5..4952a374c8 100644 --- a/exercises/practice/beer-song/beer_song_test.py +++ b/exercises/practice/beer-song/beer_song_test.py @@ -1,6 +1,8 @@ import unittest -from beer_song import recite +from beer_song import ( + recite, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/binary-search-tree/binary_search_tree_test.py b/exercises/practice/binary-search-tree/binary_search_tree_test.py index de56ccf728..23c1fea73b 100644 --- a/exercises/practice/binary-search-tree/binary_search_tree_test.py +++ b/exercises/practice/binary-search-tree/binary_search_tree_test.py @@ -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` diff --git a/exercises/practice/binary-search/binary_search_test.py b/exercises/practice/binary-search/binary_search_test.py index 7e70550818..b2ef00cb0b 100644 --- a/exercises/practice/binary-search/binary_search_test.py +++ b/exercises/practice/binary-search/binary_search_test.py @@ -1,6 +1,8 @@ import unittest -from binary_search import find +from binary_search import ( + find, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/bob/bob_test.py b/exercises/practice/bob/bob_test.py index 94f85e6d0c..40081b045f 100644 --- a/exercises/practice/bob/bob_test.py +++ b/exercises/practice/bob/bob_test.py @@ -1,6 +1,8 @@ import unittest -from bob import response +from bob import ( + response, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/book-store/book_store_test.py b/exercises/practice/book-store/book_store_test.py index f7e0348b31..7680e24610 100644 --- a/exercises/practice/book-store/book_store_test.py +++ b/exercises/practice/book-store/book_store_test.py @@ -1,6 +1,8 @@ import unittest -from book_store import total +from book_store import ( + total, +) # Tests adapted from `problem-specifications//canonical-data.json` @@ -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) diff --git a/exercises/practice/bowling/bowling_test.py b/exercises/practice/bowling/bowling_test.py index 00d2ff4245..971b8f71de 100644 --- a/exercises/practice/bowling/bowling_test.py +++ b/exercises/practice/bowling/bowling_test.py @@ -1,6 +1,8 @@ import unittest -from bowling import BowlingGame +from bowling import ( + BowlingGame, +) # Tests adapted from `problem-specifications//canonical-data.json` @@ -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) @@ -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) @@ -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) @@ -107,7 +109,7 @@ 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) @@ -115,7 +117,7 @@ def test_bonus_roll_after_a_strike_in_the_last_frame_cannot_score_more_than_10_p 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) @@ -123,14 +125,14 @@ def test_two_bonus_rolls_after_a_strike_in_the_last_frame_cannot_score_more_than 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) @@ -138,7 +140,7 @@ def test_the_second_bonus_rolls_after_a_strike_in_the_last_frame_cannot_be_a_str 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) @@ -164,7 +166,7 @@ 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) @@ -172,7 +174,7 @@ def test_bonus_rolls_for_a_strike_in_the_last_frame_must_be_rolled_before_score_ 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) @@ -180,7 +182,7 @@ def test_both_bonus_rolls_for_a_strike_in_the_last_frame_must_be_rolled_before_s 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) diff --git a/exercises/practice/change/change_test.py b/exercises/practice/change/change_test.py index 26fa08faa8..313fb019fa 100644 --- a/exercises/practice/change/change_test.py +++ b/exercises/practice/change/change_test.py @@ -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` diff --git a/exercises/practice/circular-buffer/circular_buffer_test.py b/exercises/practice/circular-buffer/circular_buffer_test.py index d3db1071db..3d8353a7e1 100644 --- a/exercises/practice/circular-buffer/circular_buffer_test.py +++ b/exercises/practice/circular-buffer/circular_buffer_test.py @@ -1,6 +1,8 @@ import unittest -from circular_buffer import CircularBuffer +from circular_buffer import ( + CircularBuffer, +) # Tests adapted from `problem-specifications//canonical-data.json` @@ -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") diff --git a/exercises/practice/clock/clock_test.py b/exercises/practice/clock/clock_test.py index 0c3c3dd46f..f73af0947b 100644 --- a/exercises/practice/clock/clock_test.py +++ b/exercises/practice/clock/clock_test.py @@ -1,6 +1,8 @@ import unittest -from clock import Clock +from clock import ( + Clock, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/collatz-conjecture/collatz_conjecture_test.py b/exercises/practice/collatz-conjecture/collatz_conjecture_test.py index feaea42c14..b76952a050 100644 --- a/exercises/practice/collatz-conjecture/collatz_conjecture_test.py +++ b/exercises/practice/collatz-conjecture/collatz_conjecture_test.py @@ -1,6 +1,8 @@ import unittest -from collatz_conjecture import steps +from collatz_conjecture import ( + steps, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/complex-numbers/complex_numbers_test.py b/exercises/practice/complex-numbers/complex_numbers_test.py index b992865cce..e0acc7661f 100644 --- a/exercises/practice/complex-numbers/complex_numbers_test.py +++ b/exercises/practice/complex-numbers/complex_numbers_test.py @@ -3,7 +3,9 @@ import unittest -from complex_numbers import ComplexNumber +from complex_numbers import ( + ComplexNumber, +) # Tests adapted from `problem-specifications//canonical-data.json` @@ -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) diff --git a/exercises/practice/connect/connect_test.py b/exercises/practice/connect/connect_test.py index 375859ae4d..17c786c865 100644 --- a/exercises/practice/connect/connect_test.py +++ b/exercises/practice/connect/connect_test.py @@ -1,6 +1,8 @@ import unittest -from connect import ConnectGame +from connect import ( + ConnectGame, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/crypto-square/crypto_square_test.py b/exercises/practice/crypto-square/crypto_square_test.py index f53bdacd3c..4829f90565 100644 --- a/exercises/practice/crypto-square/crypto_square_test.py +++ b/exercises/practice/crypto-square/crypto_square_test.py @@ -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` @@ -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 " diff --git a/exercises/practice/custom-set/custom_set_test.py b/exercises/practice/custom-set/custom_set_test.py index d54fd0cd81..e5e3ffd3bc 100644 --- a/exercises/practice/custom-set/custom_set_test.py +++ b/exercises/practice/custom-set/custom_set_test.py @@ -1,6 +1,8 @@ import unittest -from custom_set import CustomSet +from custom_set import ( + CustomSet, +) # Tests adapted from `problem-specifications//canonical-data.json` @@ -154,7 +156,7 @@ def test_intersection_of_two_sets_with_no_shared_elements_is_an_empty_set(self): self.assertEqual(set1.intersection(set2), expected) def test_intersection_of_two_sets_with_shared_elements_is_a_set_of_the_shared_elements( - self + self, ): set1 = CustomSet([1, 2, 3, 4]) set2 = CustomSet([3, 2, 5]) @@ -180,7 +182,7 @@ def test_difference_of_a_non_empty_set_and_an_empty_set_is_the_non_empty_set(sel 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( - self + self, ): set1 = CustomSet([3, 2, 1]) set2 = CustomSet([2, 4]) diff --git a/exercises/practice/darts/darts_test.py b/exercises/practice/darts/darts_test.py index c479afd128..c720e5a787 100644 --- a/exercises/practice/darts/darts_test.py +++ b/exercises/practice/darts/darts_test.py @@ -1,6 +1,8 @@ import unittest -from darts import score +from darts import ( + score, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/diamond/diamond_test.py b/exercises/practice/diamond/diamond_test.py index c82eb94945..f0e60c862d 100644 --- a/exercises/practice/diamond/diamond_test.py +++ b/exercises/practice/diamond/diamond_test.py @@ -1,6 +1,8 @@ import unittest -from diamond import rows +from diamond import ( + rows, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/difference-of-squares/difference_of_squares_test.py b/exercises/practice/difference-of-squares/difference_of_squares_test.py index c634cea238..8c2069e4d9 100644 --- a/exercises/practice/difference-of-squares/difference_of_squares_test.py +++ b/exercises/practice/difference-of-squares/difference_of_squares_test.py @@ -1,6 +1,10 @@ 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` diff --git a/exercises/practice/diffie-hellman/diffie_hellman_test.py b/exercises/practice/diffie-hellman/diffie_hellman_test.py index a56df30c69..975c57f9b1 100644 --- a/exercises/practice/diffie-hellman/diffie_hellman_test.py +++ b/exercises/practice/diffie-hellman/diffie_hellman_test.py @@ -1,6 +1,10 @@ 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` @@ -24,13 +28,27 @@ def test_can_calculate_public_key_using_private_key(self): p = 23 g = 5 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): p = 23 their_public_key = 19 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): p = 23 diff --git a/exercises/practice/dnd-character/dnd_character_test.py b/exercises/practice/dnd-character/dnd_character_test.py index 01424a92b3..b3a93e5759 100644 --- a/exercises/practice/dnd-character/dnd_character_test.py +++ b/exercises/practice/dnd-character/dnd_character_test.py @@ -1,6 +1,9 @@ import unittest -from dnd_character import Character, modifier +from dnd_character import ( + Character, + modifier, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/dominoes/dominoes_test.py b/exercises/practice/dominoes/dominoes_test.py index a4b5cbffb9..3f0b289908 100644 --- a/exercises/practice/dominoes/dominoes_test.py +++ b/exercises/practice/dominoes/dominoes_test.py @@ -1,6 +1,8 @@ import unittest -from dominoes import can_chain +from dominoes import ( + can_chain, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/etl/etl_test.py b/exercises/practice/etl/etl_test.py index 5f8a2af8ea..693ecb9e86 100644 --- a/exercises/practice/etl/etl_test.py +++ b/exercises/practice/etl/etl_test.py @@ -1,6 +1,8 @@ import unittest -from etl import transform +from etl import ( + transform, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/flatten-array/flatten_array_test.py b/exercises/practice/flatten-array/flatten_array_test.py index 3cfb57f23f..269b0ba94c 100644 --- a/exercises/practice/flatten-array/flatten_array_test.py +++ b/exercises/practice/flatten-array/flatten_array_test.py @@ -1,6 +1,8 @@ import unittest -from flatten_array import flatten +from flatten_array import ( + flatten, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/food-chain/food_chain_test.py b/exercises/practice/food-chain/food_chain_test.py index 435d7a1e85..d77953527e 100644 --- a/exercises/practice/food-chain/food_chain_test.py +++ b/exercises/practice/food-chain/food_chain_test.py @@ -1,6 +1,8 @@ import unittest -from food_chain import recite +from food_chain import ( + recite, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/forth/forth_test.py b/exercises/practice/forth/forth_test.py index a6a2b499b9..737956b404 100644 --- a/exercises/practice/forth/forth_test.py +++ b/exercises/practice/forth/forth_test.py @@ -1,6 +1,9 @@ import unittest -from forth import evaluate, StackUnderflowError +from forth import ( + evaluate, + StackUnderflowError, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/gigasecond/gigasecond_test.py b/exercises/practice/gigasecond/gigasecond_test.py index c787bae04c..76ff16a64c 100644 --- a/exercises/practice/gigasecond/gigasecond_test.py +++ b/exercises/practice/gigasecond/gigasecond_test.py @@ -1,7 +1,9 @@ from datetime import datetime import unittest -from gigasecond import add +from gigasecond import ( + add, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/go-counting/go_counting_test.py b/exercises/practice/go-counting/go_counting_test.py index 44b9a099f1..60c97cc414 100644 --- a/exercises/practice/go-counting/go_counting_test.py +++ b/exercises/practice/go-counting/go_counting_test.py @@ -1,6 +1,11 @@ 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` diff --git a/exercises/practice/grade-school/grade_school_test.py b/exercises/practice/grade-school/grade_school_test.py index 02642a52ff..2670800176 100644 --- a/exercises/practice/grade-school/grade_school_test.py +++ b/exercises/practice/grade-school/grade_school_test.py @@ -1,6 +1,8 @@ import unittest -from grade_school import School +from grade_school import ( + School, +) # Tests adapted from `problem-specifications//canonical-data.json` @@ -12,7 +14,7 @@ def test_adding_a_student_adds_them_to_the_sorted_roster(self): expected = ["Aimee"] 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.add_student(name="Blair", grade=2) school.add_student(name="James", grade=2) @@ -21,7 +23,7 @@ def test_adding_more_student_adds_them_to_the_sorted_roster(self): self.assertEqual(school.roster(), expected) def test_adding_students_to_different_grades_adds_them_to_the_same_sorted_roster( - self + self, ): school = School() school.add_student(name="Chelsea", grade=3) diff --git a/exercises/practice/grains/grains_test.py b/exercises/practice/grains/grains_test.py index de4e8de8e4..ed528501ed 100644 --- a/exercises/practice/grains/grains_test.py +++ b/exercises/practice/grains/grains_test.py @@ -1,30 +1,33 @@ import unittest -from grains import square, total +from grains import ( + square, + total, +) # Tests adapted from `problem-specifications//canonical-data.json` class GrainsTest(unittest.TestCase): - def test_1(self): + def test_grains_on_square_1(self): self.assertEqual(square(1), 1) - def test_2(self): + def test_grains_on_square_2(self): self.assertEqual(square(2), 2) - def test_3(self): + def test_grains_on_square_3(self): self.assertEqual(square(3), 4) - def test_4(self): + def test_grains_on_square_4(self): self.assertEqual(square(4), 8) - def test_16(self): + def test_grains_on_square_16(self): self.assertEqual(square(16), 32768) - def test_32(self): + def test_grains_on_square_32(self): self.assertEqual(square(32), 2147483648) - def test_64(self): + def test_grains_on_square_64(self): self.assertEqual(square(64), 9223372036854775808) def test_square_0_raises_an_exception(self): diff --git a/exercises/practice/grep/grep_test.py b/exercises/practice/grep/grep_test.py index 4dea70e202..804071542d 100644 --- a/exercises/practice/grep/grep_test.py +++ b/exercises/practice/grep/grep_test.py @@ -1,6 +1,8 @@ import unittest -from grep import grep +from grep import ( + grep, +) # Tests adapted from `problem-specifications//canonical-data.json` import io diff --git a/exercises/practice/hamming/hamming_test.py b/exercises/practice/hamming/hamming_test.py index 555d9e9895..885ae0a88e 100644 --- a/exercises/practice/hamming/hamming_test.py +++ b/exercises/practice/hamming/hamming_test.py @@ -1,6 +1,8 @@ import unittest -from hamming import distance +from hamming import ( + distance, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/hello-world/hello_world_test.py b/exercises/practice/hello-world/hello_world_test.py index 82dc88ef3c..39c9612482 100644 --- a/exercises/practice/hello-world/hello_world_test.py +++ b/exercises/practice/hello-world/hello_world_test.py @@ -1,6 +1,8 @@ import unittest -from hello_world import hello +from hello_world import ( + hello, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/high-scores/high_scores_test.py b/exercises/practice/high-scores/high_scores_test.py index be0ad6e8be..04b788a1b2 100644 --- a/exercises/practice/high-scores/high_scores_test.py +++ b/exercises/practice/high-scores/high_scores_test.py @@ -1,6 +1,10 @@ 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` diff --git a/exercises/practice/house/house_test.py b/exercises/practice/house/house_test.py index 60e1b39b8a..0facef614f 100644 --- a/exercises/practice/house/house_test.py +++ b/exercises/practice/house/house_test.py @@ -1,6 +1,8 @@ import unittest -from house import recite +from house import ( + recite, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/isbn-verifier/isbn_verifier_test.py b/exercises/practice/isbn-verifier/isbn_verifier_test.py index ece22ce06c..7b8a5324ca 100644 --- a/exercises/practice/isbn-verifier/isbn_verifier_test.py +++ b/exercises/practice/isbn-verifier/isbn_verifier_test.py @@ -1,6 +1,8 @@ import unittest -from isbn_verifier import is_valid +from isbn_verifier import ( + is_valid, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/isogram/isogram_test.py b/exercises/practice/isogram/isogram_test.py index 013e9b8923..11aca026cc 100644 --- a/exercises/practice/isogram/isogram_test.py +++ b/exercises/practice/isogram/isogram_test.py @@ -1,6 +1,8 @@ import unittest -from isogram import is_isogram +from isogram import ( + is_isogram, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/kindergarten-garden/kindergarten_garden_test.py b/exercises/practice/kindergarten-garden/kindergarten_garden_test.py index 7f6325c953..6b4ba3580e 100644 --- a/exercises/practice/kindergarten-garden/kindergarten_garden_test.py +++ b/exercises/practice/kindergarten-garden/kindergarten_garden_test.py @@ -1,6 +1,8 @@ import unittest -from kindergarten_garden import Garden +from kindergarten_garden import ( + Garden, +) # Tests adapted from `problem-specifications//canonical-data.json` @@ -32,23 +34,23 @@ def test_partial_garden_third_student_s_garden(self): garden = Garden("VVCCGG\nVVCCGG") 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") self.assertEqual( 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") 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") self.assertEqual( 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") self.assertEqual( garden.plants("Larry"), ["Grass", "Violets", "Clover", "Violets"] diff --git a/exercises/practice/knapsack/knapsack_test.py b/exercises/practice/knapsack/knapsack_test.py index bfb75c38d7..0a792f179c 100644 --- a/exercises/practice/knapsack/knapsack_test.py +++ b/exercises/practice/knapsack/knapsack_test.py @@ -1,6 +1,8 @@ import unittest -from knapsack import maximum_value +from knapsack import ( + maximum_value, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/largest-series-product/largest_series_product_test.py b/exercises/practice/largest-series-product/largest_series_product_test.py index 3b0e511f25..ddb91e6def 100644 --- a/exercises/practice/largest-series-product/largest_series_product_test.py +++ b/exercises/practice/largest-series-product/largest_series_product_test.py @@ -1,6 +1,8 @@ import unittest -from largest_series_product import largest_product +from largest_series_product import ( + largest_product, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/leap/leap_test.py b/exercises/practice/leap/leap_test.py index 3db4e247d3..e51aeb423a 100644 --- a/exercises/practice/leap/leap_test.py +++ b/exercises/practice/leap/leap_test.py @@ -1,6 +1,8 @@ import unittest -from leap import leap_year +from leap import ( + leap_year, +) # Tests adapted from `problem-specifications//canonical-data.json` @@ -24,7 +26,7 @@ def test_year_divisible_by_100_not_divisible_by_400_in_common_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) - 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) def test_year_divisible_by_400_but_not_by_125_is_still_a_leap_year(self): diff --git a/exercises/practice/luhn/luhn_test.py b/exercises/practice/luhn/luhn_test.py index e22f851798..b0ee748fce 100644 --- a/exercises/practice/luhn/luhn_test.py +++ b/exercises/practice/luhn/luhn_test.py @@ -1,6 +1,8 @@ import unittest -from luhn import Luhn +from luhn import ( + Luhn, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/markdown/markdown_test.py b/exercises/practice/markdown/markdown_test.py index 2f3678133c..5f18a6ba6a 100644 --- a/exercises/practice/markdown/markdown_test.py +++ b/exercises/practice/markdown/markdown_test.py @@ -1,6 +1,8 @@ import unittest -from markdown import parse +from markdown import ( + parse, +) # Tests adapted from `problem-specifications//canonical-data.json` @@ -50,7 +52,7 @@ def test_with_a_little_bit_of_everything(self): ) def test_with_markdown_symbols_in_the_header_text_that_should_not_be_interpreted( - self + self, ): self.assertEqual( parse("# This is a header with # and * in the text"), @@ -58,7 +60,7 @@ def test_with_markdown_symbols_in_the_header_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( parse("* Item 1 with a # in the text\n* Item 2 with * in the text"), @@ -66,7 +68,7 @@ def test_with_markdown_symbols_in_the_list_item_text_that_should_not_be_interpre ) def test_with_markdown_symbols_in_the_paragraph_text_that_should_not_be_interpreted( - self + self, ): self.assertEqual( parse("This is a paragraph with # and * in the text"), diff --git a/exercises/practice/matching-brackets/matching_brackets_test.py b/exercises/practice/matching-brackets/matching_brackets_test.py index dd3304dd67..e4330bfd9d 100644 --- a/exercises/practice/matching-brackets/matching_brackets_test.py +++ b/exercises/practice/matching-brackets/matching_brackets_test.py @@ -1,6 +1,8 @@ import unittest -from matching_brackets import is_paired +from matching_brackets import ( + is_paired, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/matrix/matrix_test.py b/exercises/practice/matrix/matrix_test.py index 9176dd9af0..10820ab6c1 100644 --- a/exercises/practice/matrix/matrix_test.py +++ b/exercises/practice/matrix/matrix_test.py @@ -1,6 +1,8 @@ import unittest -from matrix import Matrix +from matrix import ( + Matrix, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/meetup/meetup_test.py b/exercises/practice/meetup/meetup_test.py index 029f1e959a..7b4d6d2915 100644 --- a/exercises/practice/meetup/meetup_test.py +++ b/exercises/practice/meetup/meetup_test.py @@ -1,7 +1,10 @@ from datetime import date import unittest -from meetup import meetup, MeetupDayException +from meetup import ( + meetup, + MeetupDayException, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/minesweeper/minesweeper_test.py b/exercises/practice/minesweeper/minesweeper_test.py index c063ac93e4..3da8ef1557 100644 --- a/exercises/practice/minesweeper/minesweeper_test.py +++ b/exercises/practice/minesweeper/minesweeper_test.py @@ -1,6 +1,8 @@ import unittest -from minesweeper import annotate +from minesweeper import ( + annotate, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/nth-prime/nth_prime_test.py b/exercises/practice/nth-prime/nth_prime_test.py index d2086b7c43..f928e3d2bc 100644 --- a/exercises/practice/nth-prime/nth_prime_test.py +++ b/exercises/practice/nth-prime/nth_prime_test.py @@ -1,6 +1,8 @@ import unittest -from nth_prime import prime +from nth_prime import ( + prime, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/ocr-numbers/ocr_numbers_test.py b/exercises/practice/ocr-numbers/ocr_numbers_test.py index f38f0fb19b..dad28aee62 100644 --- a/exercises/practice/ocr-numbers/ocr_numbers_test.py +++ b/exercises/practice/ocr-numbers/ocr_numbers_test.py @@ -1,6 +1,8 @@ import unittest -from ocr_numbers import convert +from ocr_numbers import ( + convert, +) # Tests adapted from `problem-specifications//canonical-data.json` @@ -16,13 +18,13 @@ def test_unreadable_but_correctly_sized_inputs_return(self): self.assertEqual(convert([" ", " _", " |", " "]), "?") def test_input_with_a_number_of_lines_that_is_not_a_multiple_of_four_raises_an_error( - self + self, ): with self.assertRaisesWithMessage(ValueError): convert([" _ ", "| |", " "]) def test_input_with_a_number_of_columns_that_is_not_a_multiple_of_three_raises_an_error( - self + self, ): with self.assertRaisesWithMessage(ValueError): convert([" ", " |", " |", " "]) @@ -91,7 +93,7 @@ def test_recognizes_string_of_decimal_numbers(self): ) def test_numbers_separated_by_empty_lines_are_recognized_lines_are_joined_by_commas( - self + self, ): self.assertEqual( convert( diff --git a/exercises/practice/palindrome-products/palindrome_products_test.py b/exercises/practice/palindrome-products/palindrome_products_test.py index 4e7ddcc17b..f88e8ee66f 100644 --- a/exercises/practice/palindrome-products/palindrome_products_test.py +++ b/exercises/practice/palindrome-products/palindrome_products_test.py @@ -1,6 +1,9 @@ import unittest -from palindrome_products import largest, smallest +from palindrome_products import ( + largest, + smallest, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/pangram/pangram_test.py b/exercises/practice/pangram/pangram_test.py index 034d5dd769..36c61adb95 100644 --- a/exercises/practice/pangram/pangram_test.py +++ b/exercises/practice/pangram/pangram_test.py @@ -1,6 +1,8 @@ import unittest -from pangram import is_pangram +from pangram import ( + is_pangram, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/perfect-numbers/perfect_numbers_test.py b/exercises/practice/perfect-numbers/perfect_numbers_test.py index 0bf7dbfa5d..9139a44a9e 100644 --- a/exercises/practice/perfect-numbers/perfect_numbers_test.py +++ b/exercises/practice/perfect-numbers/perfect_numbers_test.py @@ -1,6 +1,8 @@ import unittest -from perfect_numbers import classify +from perfect_numbers import ( + classify, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/phone-number/phone_number_test.py b/exercises/practice/phone-number/phone_number_test.py index 71ff522376..8fb616e390 100644 --- a/exercises/practice/phone-number/phone_number_test.py +++ b/exercises/practice/phone-number/phone_number_test.py @@ -1,6 +1,8 @@ import unittest -from phone_number import PhoneNumber +from phone_number import ( + PhoneNumber, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/pig-latin/pig_latin_test.py b/exercises/practice/pig-latin/pig_latin_test.py index 2cef287d1a..cf666ddf3a 100644 --- a/exercises/practice/pig-latin/pig_latin_test.py +++ b/exercises/practice/pig-latin/pig_latin_test.py @@ -1,6 +1,8 @@ import unittest -from pig_latin import translate +from pig_latin import ( + translate, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/poker/poker_test.py b/exercises/practice/poker/poker_test.py index 8b97906d8a..8aee2d61fe 100644 --- a/exercises/practice/poker/poker_test.py +++ b/exercises/practice/poker/poker_test.py @@ -1,6 +1,8 @@ import unittest -from poker import best_hands +from poker import ( + best_hands, +) # Tests adapted from `problem-specifications//canonical-data.json` @@ -29,7 +31,7 @@ def test_a_tie_has_multiple_winners(self): ) def test_multiple_hands_with_the_same_high_cards_tie_compares_next_highest_ranked_down_to_last_card( - self + self, ): self.assertEqual( best_hands(["3S 5H 6S 8D 7H", "2S 5D 6D 8C 7S"]), ["3S 5H 6S 8D 7H"] @@ -56,14 +58,14 @@ def test_both_hands_have_two_pairs_highest_ranked_pair_wins(self): ) def test_both_hands_have_two_pairs_with_the_same_highest_ranked_pair_tie_goes_to_low_pair( - self + self, ): self.assertEqual( 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( - self + self, ): self.assertEqual( best_hands(["JD QH JS 8D QC", "JS QS JC 2D QD"]), ["JD QH JS 8D QC"] @@ -80,7 +82,7 @@ def test_both_hands_have_three_of_a_kind_tie_goes_to_highest_ranked_triplet(self ) def test_with_multiple_decks_two_players_can_have_same_three_of_a_kind_ties_go_to_highest_remaining_cards( - self + self, ): self.assertEqual( best_hands(["4S AH AS 7C AD", "4S AH AS 8C AD"]), ["4S AH AS 8C AD"] @@ -107,7 +109,7 @@ def test_both_hands_with_a_straight_tie_goes_to_highest_ranked_card(self): ) def test_even_though_an_ace_is_usually_high_a_5_high_straight_is_the_lowest_scoring_straight( - self + self, ): self.assertEqual( best_hands(["2H 3C 4D 5D 6H", "4S AH 3S 2D 5H"]), ["2H 3C 4D 5D 6H"] @@ -119,7 +121,7 @@ def test_flush_beats_a_straight(self): ) def test_both_hands_have_a_flush_tie_goes_to_high_card_down_to_the_last_one_if_necessary( - self + self, ): self.assertEqual( best_hands(["4H 7H 8H 9H 6H", "2S 4S 5S 6S 7S"]), ["4H 7H 8H 9H 6H"] @@ -136,7 +138,7 @@ def test_both_hands_have_a_full_house_tie_goes_to_highest_ranked_triplet(self): ) def test_with_multiple_decks_both_hands_have_a_full_house_with_the_same_triplet_tie_goes_to_the_pair( - self + self, ): self.assertEqual( best_hands(["5H 5S 5D 9S 9D", "5H 5S 5D 8S 8D"]), ["5H 5S 5D 9S 9D"] @@ -153,7 +155,7 @@ def test_both_hands_have_four_of_a_kind_tie_goes_to_high_quad(self): ) def test_with_multiple_decks_both_hands_with_identical_four_of_a_kind_tie_determined_by_kicker( - self + self, ): self.assertEqual( best_hands(["3S 3H 2S 3D 3C", "3S 3H 4S 3D 3C"]), ["3S 3H 4S 3D 3C"] diff --git a/exercises/practice/pov/pov_test.py b/exercises/practice/pov/pov_test.py index 5e93076b8d..5d8832e287 100644 --- a/exercises/practice/pov/pov_test.py +++ b/exercises/practice/pov/pov_test.py @@ -1,6 +1,8 @@ import unittest -from pov import Tree +from pov import ( + Tree, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/prime-factors/prime_factors_test.py b/exercises/practice/prime-factors/prime_factors_test.py index 4995460aff..80deb17caa 100644 --- a/exercises/practice/prime-factors/prime_factors_test.py +++ b/exercises/practice/prime-factors/prime_factors_test.py @@ -1,6 +1,8 @@ import unittest -from prime_factors import factors +from prime_factors import ( + factors, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/protein-translation/protein_translation_test.py b/exercises/practice/protein-translation/protein_translation_test.py index ede1822502..32ed73774c 100644 --- a/exercises/practice/protein-translation/protein_translation_test.py +++ b/exercises/practice/protein-translation/protein_translation_test.py @@ -1,6 +1,8 @@ import unittest -from protein_translation import proteins +from protein_translation import ( + proteins, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/pythagorean-triplet/pythagorean_triplet_test.py b/exercises/practice/pythagorean-triplet/pythagorean_triplet_test.py index 6ea67f25d0..70d501c4fb 100644 --- a/exercises/practice/pythagorean-triplet/pythagorean_triplet_test.py +++ b/exercises/practice/pythagorean-triplet/pythagorean_triplet_test.py @@ -1,6 +1,8 @@ import unittest -from pythagorean_triplet import triplets_with_sum +from pythagorean_triplet import ( + triplets_with_sum, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/queen-attack/queen_attack_test.py b/exercises/practice/queen-attack/queen_attack_test.py index 612fe2f6d4..8f9438dc67 100644 --- a/exercises/practice/queen-attack/queen_attack_test.py +++ b/exercises/practice/queen-attack/queen_attack_test.py @@ -1,6 +1,8 @@ import unittest -from queen_attack import Queen +from queen_attack import ( + Queen, +) # Tests adapted from `problem-specifications//canonical-data.json` @@ -27,7 +29,7 @@ def test_queen_must_have_column_on_board(self): Queen(4, 8) # 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) def test_can_attack_on_same_row(self): diff --git a/exercises/practice/rail-fence-cipher/rail_fence_cipher_test.py b/exercises/practice/rail-fence-cipher/rail_fence_cipher_test.py index fc57b79293..65743180a7 100644 --- a/exercises/practice/rail-fence-cipher/rail_fence_cipher_test.py +++ b/exercises/practice/rail-fence-cipher/rail_fence_cipher_test.py @@ -1,6 +1,9 @@ import unittest -from rail_fence_cipher import decode, encode +from rail_fence_cipher import ( + decode, + encode, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/raindrops/raindrops_test.py b/exercises/practice/raindrops/raindrops_test.py index 8ac1a43d03..247f4daa47 100644 --- a/exercises/practice/raindrops/raindrops_test.py +++ b/exercises/practice/raindrops/raindrops_test.py @@ -1,6 +1,8 @@ import unittest -from raindrops import convert +from raindrops import ( + convert, +) # Tests adapted from `problem-specifications//canonical-data.json` @@ -22,7 +24,7 @@ def test_the_sound_for_6_is_pling_as_it_has_a_factor_3(self): 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( - self + self, ): self.assertEqual(convert(8), "8") diff --git a/exercises/practice/rational-numbers/rational_numbers_test.py b/exercises/practice/rational-numbers/rational_numbers_test.py index e83ac11e3d..b7c67178ee 100644 --- a/exercises/practice/rational-numbers/rational_numbers_test.py +++ b/exercises/practice/rational-numbers/rational_numbers_test.py @@ -1,7 +1,9 @@ from __future__ import division import unittest -from rational_numbers import Rational +from rational_numbers import ( + Rational, +) # Tests adapted from `problem-specifications//canonical-data.json` @@ -78,7 +80,7 @@ def test_absolute_value_of_a_positive_rational_number(self): self.assertEqual(abs(Rational(1, 2)), Rational(1, 2)) 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)) @@ -86,7 +88,7 @@ def test_absolute_value_of_a_negative_rational_number(self): self.assertEqual(abs(Rational(-1, 2)), Rational(1, 2)) def test_absolute_value_of_a_negative_rational_number_with_negative_denominator( - self + self, ): self.assertEqual(abs(Rational(1, -2)), Rational(1, 2)) diff --git a/exercises/practice/rectangles/rectangles_test.py b/exercises/practice/rectangles/rectangles_test.py index 534f1beb2c..3cfa8181cf 100644 --- a/exercises/practice/rectangles/rectangles_test.py +++ b/exercises/practice/rectangles/rectangles_test.py @@ -1,6 +1,8 @@ import unittest -from rectangles import rectangles +from rectangles import ( + rectangles, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/resistor-color-duo/resistor_color_duo_test.py b/exercises/practice/resistor-color-duo/resistor_color_duo_test.py index 9b212c9f0c..c259f5db79 100644 --- a/exercises/practice/resistor-color-duo/resistor_color_duo_test.py +++ b/exercises/practice/resistor-color-duo/resistor_color_duo_test.py @@ -1,6 +1,8 @@ import unittest -from resistor_color_duo import value +from resistor_color_duo import ( + value, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/resistor-color/resistor_color_test.py b/exercises/practice/resistor-color/resistor_color_test.py index 96e4f6c938..62ab48625f 100644 --- a/exercises/practice/resistor-color/resistor_color_test.py +++ b/exercises/practice/resistor-color/resistor_color_test.py @@ -1,6 +1,9 @@ import unittest -from resistor_color import color_code, colors +from resistor_color import ( + color_code, + colors, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/rest-api/rest_api_test.py b/exercises/practice/rest-api/rest_api_test.py index 5f53049bf4..8092aec237 100644 --- a/exercises/practice/rest-api/rest_api_test.py +++ b/exercises/practice/rest-api/rest_api_test.py @@ -1,6 +1,8 @@ import unittest -from rest_api import RestAPI +from rest_api import ( + RestAPI, +) # Tests adapted from `problem-specifications//canonical-data.json` import json diff --git a/exercises/practice/reverse-string/reverse_string_test.py b/exercises/practice/reverse-string/reverse_string_test.py index 18724a0ae3..78212b41de 100644 --- a/exercises/practice/reverse-string/reverse_string_test.py +++ b/exercises/practice/reverse-string/reverse_string_test.py @@ -1,6 +1,8 @@ import unittest -from reverse_string import reverse +from reverse_string import ( + reverse, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/rna-transcription/rna_transcription_test.py b/exercises/practice/rna-transcription/rna_transcription_test.py index 1d7193a042..aa06232959 100644 --- a/exercises/practice/rna-transcription/rna_transcription_test.py +++ b/exercises/practice/rna-transcription/rna_transcription_test.py @@ -1,6 +1,8 @@ import unittest -from rna_transcription import to_rna +from rna_transcription import ( + to_rna, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/robot-simulator/robot_simulator_test.py b/exercises/practice/robot-simulator/robot_simulator_test.py index e67402a38c..9622653290 100644 --- a/exercises/practice/robot-simulator/robot_simulator_test.py +++ b/exercises/practice/robot-simulator/robot_simulator_test.py @@ -1,6 +1,12 @@ 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` diff --git a/exercises/practice/roman-numerals/roman_numerals_test.py b/exercises/practice/roman-numerals/roman_numerals_test.py index 86d0edfa01..9a0c58deee 100644 --- a/exercises/practice/roman-numerals/roman_numerals_test.py +++ b/exercises/practice/roman-numerals/roman_numerals_test.py @@ -1,6 +1,8 @@ import unittest -from roman_numerals import roman +from roman_numerals import ( + roman, +) # Tests adapted from `problem-specifications//canonical-data.json` class RomanNumeralsTest(unittest.TestCase): diff --git a/exercises/practice/rotational-cipher/rotational_cipher_test.py b/exercises/practice/rotational-cipher/rotational_cipher_test.py index 1ba3fc1e2c..88b64d6edb 100644 --- a/exercises/practice/rotational-cipher/rotational_cipher_test.py +++ b/exercises/practice/rotational-cipher/rotational_cipher_test.py @@ -1,6 +1,8 @@ import unittest -from rotational_cipher import rotate +from rotational_cipher import ( + rotate, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/run-length-encoding/run_length_encoding_test.py b/exercises/practice/run-length-encoding/run_length_encoding_test.py index 6e302b3fb5..94b84c7391 100644 --- a/exercises/practice/run-length-encoding/run_length_encoding_test.py +++ b/exercises/practice/run-length-encoding/run_length_encoding_test.py @@ -1,6 +1,9 @@ import unittest -from run_length_encoding import encode, decode +from run_length_encoding import ( + encode, + decode, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/saddle-points/saddle_points_test.py b/exercises/practice/saddle-points/saddle_points_test.py index 77d96572aa..45b12b63a4 100644 --- a/exercises/practice/saddle-points/saddle_points_test.py +++ b/exercises/practice/saddle-points/saddle_points_test.py @@ -7,7 +7,9 @@ """ import unittest -from saddle_points import saddle_points +from saddle_points import ( + saddle_points, +) # Tests adapted from `problem-specifications//canonical-data.json` @@ -73,7 +75,7 @@ def test_can_identify_saddle_points_in_a_non_square_matrix(self): ) 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]] self.assertEqual( @@ -82,7 +84,7 @@ def test_can_identify_that_saddle_points_in_a_single_column_matrix_are_those_wit ) 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]] self.assertEqual( diff --git a/exercises/practice/satellite/satellite_test.py b/exercises/practice/satellite/satellite_test.py index 704d9e3f44..8f112fc8a1 100644 --- a/exercises/practice/satellite/satellite_test.py +++ b/exercises/practice/satellite/satellite_test.py @@ -1,6 +1,8 @@ import unittest -from satellite import tree_from_traversals +from satellite import ( + tree_from_traversals, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/say/say_test.py b/exercises/practice/say/say_test.py index aabbc2a515..1bc4b60cbf 100644 --- a/exercises/practice/say/say_test.py +++ b/exercises/practice/say/say_test.py @@ -1,6 +1,8 @@ import unittest -from say import say +from say import ( + say, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/scale-generator/scale_generator_test.py b/exercises/practice/scale-generator/scale_generator_test.py index 2be4a631f6..c22ef166fd 100644 --- a/exercises/practice/scale-generator/scale_generator_test.py +++ b/exercises/practice/scale-generator/scale_generator_test.py @@ -1,6 +1,8 @@ import unittest -from scale_generator import Scale +from scale_generator import ( + Scale, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/scrabble-score/scrabble_score_test.py b/exercises/practice/scrabble-score/scrabble_score_test.py index f3bce4f8e6..e8d7eff75e 100644 --- a/exercises/practice/scrabble-score/scrabble_score_test.py +++ b/exercises/practice/scrabble-score/scrabble_score_test.py @@ -1,6 +1,8 @@ import unittest -from scrabble_score import score +from scrabble_score import ( + score, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/secret-handshake/secret_handshake_test.py b/exercises/practice/secret-handshake/secret_handshake_test.py index 72d0e82515..42b8dcdc89 100644 --- a/exercises/practice/secret-handshake/secret_handshake_test.py +++ b/exercises/practice/secret-handshake/secret_handshake_test.py @@ -1,6 +1,8 @@ import unittest -from secret_handshake import commands +from secret_handshake import ( + commands, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/series/series_test.py b/exercises/practice/series/series_test.py index 94346d819b..78fb6619cf 100644 --- a/exercises/practice/series/series_test.py +++ b/exercises/practice/series/series_test.py @@ -1,6 +1,8 @@ import unittest -from series import slices +from series import ( + slices, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/sgf-parsing/sgf_parsing_test.py b/exercises/practice/sgf-parsing/sgf_parsing_test.py index 0baae4ead8..5f8ad91eaf 100644 --- a/exercises/practice/sgf-parsing/sgf_parsing_test.py +++ b/exercises/practice/sgf-parsing/sgf_parsing_test.py @@ -1,6 +1,9 @@ import unittest -from sgf_parsing import parse, SgfTree +from sgf_parsing import ( + parse, + SgfTree, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/sieve/sieve_test.py b/exercises/practice/sieve/sieve_test.py index c34146f48a..d9fa67262b 100644 --- a/exercises/practice/sieve/sieve_test.py +++ b/exercises/practice/sieve/sieve_test.py @@ -1,6 +1,8 @@ import unittest -from sieve import primes +from sieve import ( + primes, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/simple-cipher/simple_cipher_test.py b/exercises/practice/simple-cipher/simple_cipher_test.py index f3dd7875aa..07c0c3d5b5 100644 --- a/exercises/practice/simple-cipher/simple_cipher_test.py +++ b/exercises/practice/simple-cipher/simple_cipher_test.py @@ -1,7 +1,9 @@ import re import unittest -from simple_cipher import Cipher +from simple_cipher import ( + Cipher, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/space-age/space_age_test.py b/exercises/practice/space-age/space_age_test.py index e319daca14..b3f91ca067 100644 --- a/exercises/practice/space-age/space_age_test.py +++ b/exercises/practice/space-age/space_age_test.py @@ -1,6 +1,8 @@ import unittest -from space_age import SpaceAge +from space_age import ( + SpaceAge, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/spiral-matrix/spiral_matrix_test.py b/exercises/practice/spiral-matrix/spiral_matrix_test.py index 3bd5aef815..1291342a89 100644 --- a/exercises/practice/spiral-matrix/spiral_matrix_test.py +++ b/exercises/practice/spiral-matrix/spiral_matrix_test.py @@ -1,6 +1,8 @@ import unittest -from spiral_matrix import spiral_matrix +from spiral_matrix import ( + spiral_matrix, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/sublist/sublist_test.py b/exercises/practice/sublist/sublist_test.py index 382144f75a..03ff9cebed 100644 --- a/exercises/practice/sublist/sublist_test.py +++ b/exercises/practice/sublist/sublist_test.py @@ -1,6 +1,12 @@ 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` diff --git a/exercises/practice/sum-of-multiples/sum_of_multiples_test.py b/exercises/practice/sum-of-multiples/sum_of_multiples_test.py index c683dea1aa..f7e8bfb540 100644 --- a/exercises/practice/sum-of-multiples/sum_of_multiples_test.py +++ b/exercises/practice/sum-of-multiples/sum_of_multiples_test.py @@ -1,6 +1,8 @@ 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` @@ -52,7 +54,7 @@ def test_the_factor_0_does_not_affect_the_sum_of_multiples_of_other_factors(self self.assertEqual(sum_of_multiples(4, [3, 0]), 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) diff --git a/exercises/practice/tournament/tournament_test.py b/exercises/practice/tournament/tournament_test.py index 4d0a0927e8..dac4c15c4b 100644 --- a/exercises/practice/tournament/tournament_test.py +++ b/exercises/practice/tournament/tournament_test.py @@ -1,6 +1,8 @@ import unittest -from tournament import tally +from tournament import ( + tally, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/transpose/transpose_test.py b/exercises/practice/transpose/transpose_test.py index e657086dfb..c47a3fdb19 100644 --- a/exercises/practice/transpose/transpose_test.py +++ b/exercises/practice/transpose/transpose_test.py @@ -1,6 +1,8 @@ import unittest -from transpose import transpose +from transpose import ( + transpose, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/triangle/triangle_test.py b/exercises/practice/triangle/triangle_test.py index e7ee2d3377..f95617b477 100644 --- a/exercises/practice/triangle/triangle_test.py +++ b/exercises/practice/triangle/triangle_test.py @@ -1,6 +1,10 @@ import unittest -from triangle import equilateral, isosceles, scalene +from triangle import ( + equilateral, + isosceles, + scalene, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/twelve-days/twelve_days_test.py b/exercises/practice/twelve-days/twelve_days_test.py index d2f90c8daf..9418eaf2b2 100644 --- a/exercises/practice/twelve-days/twelve_days_test.py +++ b/exercises/practice/twelve-days/twelve_days_test.py @@ -1,6 +1,8 @@ import unittest -from twelve_days import recite +from twelve_days import ( + recite, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/two-bucket/two_bucket_test.py b/exercises/practice/two-bucket/two_bucket_test.py index fd3cd1a5e0..15a2f6e0db 100644 --- a/exercises/practice/two-bucket/two_bucket_test.py +++ b/exercises/practice/two-bucket/two_bucket_test.py @@ -1,38 +1,40 @@ import unittest -from two_bucket import measure +from two_bucket import ( + measure, +) # Tests adapted from `problem-specifications//canonical-data.json` class TwoBucketTest(unittest.TestCase): 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)) 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)) 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)) 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)) 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)) 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)) diff --git a/exercises/practice/two-fer/two_fer_test.py b/exercises/practice/two-fer/two_fer_test.py index 90a2f937df..540930daf3 100644 --- a/exercises/practice/two-fer/two_fer_test.py +++ b/exercises/practice/two-fer/two_fer_test.py @@ -1,6 +1,8 @@ import unittest -from two_fer import two_fer +from two_fer import ( + two_fer, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/variable-length-quantity/variable_length_quantity_test.py b/exercises/practice/variable-length-quantity/variable_length_quantity_test.py index 1054b529e0..e6550d6480 100644 --- a/exercises/practice/variable-length-quantity/variable_length_quantity_test.py +++ b/exercises/practice/variable-length-quantity/variable_length_quantity_test.py @@ -1,6 +1,9 @@ import unittest -from variable_length_quantity import decode, encode +from variable_length_quantity import ( + decode, + encode, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/word-count/word_count_test.py b/exercises/practice/word-count/word_count_test.py index 5a28d28886..9450e215c9 100644 --- a/exercises/practice/word-count/word_count_test.py +++ b/exercises/practice/word-count/word_count_test.py @@ -1,6 +1,8 @@ import unittest -from word_count import count_words +from word_count import ( + count_words, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/word-search/word_search_test.py b/exercises/practice/word-search/word_search_test.py index 737f49ced3..857479abf0 100644 --- a/exercises/practice/word-search/word_search_test.py +++ b/exercises/practice/word-search/word_search_test.py @@ -1,6 +1,9 @@ import unittest -from word_search import WordSearch, Point +from word_search import ( + WordSearch, + Point, +) # Tests adapted from `problem-specifications//canonical-data.json` @@ -15,7 +18,7 @@ def test_should_locate_one_word_written_left_to_right(self): self.assertEqual(puzzle.search("clojure"), (Point(0, 0), Point(6, 0))) def test_should_locate_the_same_word_written_left_to_right_in_a_different_position( - self + self, ): puzzle = WordSearch(["mtclojurer"]) self.assertEqual(puzzle.search("clojure"), (Point(2, 0), Point(8, 0))) @@ -25,7 +28,7 @@ def test_should_locate_a_different_left_to_right_word(self): self.assertEqual(puzzle.search("coffee"), (Point(0, 0), Point(5, 0))) def test_should_locate_that_different_left_to_right_word_in_a_different_position( - self + self, ): puzzle = WordSearch(["xcoffeezlp"]) self.assertEqual(puzzle.search("coffee"), (Point(1, 0), Point(6, 0))) @@ -56,7 +59,7 @@ def test_should_locate_a_left_to_right_word_in_ten_line_grid(self): self.assertEqual(puzzle.search("clojure"), (Point(0, 9), Point(6, 9))) def test_should_locate_that_left_to_right_word_in_a_different_position_in_a_ten_line_grid( - self + self, ): puzzle = WordSearch( [ @@ -114,7 +117,7 @@ def test_should_locate_a_single_word_written_right_to_left(self): self.assertEqual(puzzle.search("elixir"), (Point(5, 0), Point(0, 0))) def test_should_locate_multiple_words_written_in_different_horizontal_directions( - self + self, ): puzzle = WordSearch( [ diff --git a/exercises/practice/wordy/wordy_test.py b/exercises/practice/wordy/wordy_test.py index 2ccc8eb215..101aef23f6 100644 --- a/exercises/practice/wordy/wordy_test.py +++ b/exercises/practice/wordy/wordy_test.py @@ -1,6 +1,8 @@ import unittest -from wordy import answer +from wordy import ( + answer, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/zebra-puzzle/zebra_puzzle_test.py b/exercises/practice/zebra-puzzle/zebra_puzzle_test.py index 88aaa96d75..034d4cccf4 100644 --- a/exercises/practice/zebra-puzzle/zebra_puzzle_test.py +++ b/exercises/practice/zebra-puzzle/zebra_puzzle_test.py @@ -1,6 +1,9 @@ import unittest -from zebra_puzzle import drinks_water, owns_zebra +from zebra_puzzle import ( + drinks_water, + owns_zebra, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/exercises/practice/zipper/zipper_test.py b/exercises/practice/zipper/zipper_test.py index a96bfa7d3a..81ab7486bd 100644 --- a/exercises/practice/zipper/zipper_test.py +++ b/exercises/practice/zipper/zipper_test.py @@ -1,6 +1,8 @@ import unittest -from zipper import Zipper +from zipper import ( + Zipper, +) # Tests adapted from `problem-specifications//canonical-data.json` diff --git a/requirements-generator.txt b/requirements-generator.txt index c98d8aa56a..7af3156b6c 100644 --- a/requirements-generator.txt +++ b/requirements-generator.txt @@ -1,4 +1,4 @@ -black==19.3b0 +black==20.8b1 flake8==3.7.8 Jinja2==2.10.1 python-dateutil==2.8.1 From d5d4ec86210533a0fb0724415beb7a5de06a69a1 Mon Sep 17 00:00:00 2001 From: Corey McCandless Date: Sun, 31 Jan 2021 16:55:18 -0500 Subject: [PATCH 09/10] do not fail generator if tests.toml not found --- bin/generate_tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/generate_tests.py b/bin/generate_tests.py index d98216bb54..e46ab3911d 100755 --- a/bin/generate_tests.py +++ b/bin/generate_tests.py @@ -297,8 +297,8 @@ def generate_exercise(env: Environment, spec_path: Path, exercise: Path, check: try: test_opts = load_tests_toml(exercise) except FileNotFoundError: - logger.error(f"{slug}: tests.toml not found; please run canonical_data_syncer") - return False + logger.error(f"{slug}: tests.toml not found; skipping.") + return True spec = load_canonical(slug, spec_path, test_opts) additional_tests = load_additional_tests(exercise) spec["additional_cases"] = additional_tests From d5fc681178b1c3fd66ad96ab231e0358f4a2bad7 Mon Sep 17 00:00:00 2001 From: Corey McCandless Date: Sun, 31 Jan 2021 16:58:14 -0500 Subject: [PATCH 10/10] install dataclasses for 3.6 --- .github/workflows/ci-workflow.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index dbe5ffa174..9c4b0875bb 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -61,6 +61,10 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Install dataclasses package + if: ${{ matrix.python-version == '3.6' }} + run: pip install dataclasses + - name: Check exercises run: | ./bin/test_exercises.py