def it_defaults_to_sokoban_if_not_specified(self): collection = PuzzlesCollection() with open( INPUT_FILES_ROOT. child('parser_test_variant_type_not_specified.sok') ) as t: SOKFileFormat.read(t, collection, None) for puzzle in collection.puzzles: assert puzzle.variant == Variant.SOKOBAN
def it_uses_value_from_colection_notes_even_if_hint_given(self): collection = PuzzlesCollection() with open( INPUT_FILES_ROOT. child('parser_test_variant_type_specified_global.sok') ) as t: SOKFileFormat.read(t, collection, Variant.OCTOBAN) for puzzle in collection.puzzles: assert puzzle.variant == Variant.TRIOBAN
def it_uses_value_from_hint_when_nothing_is_specified_in_file(self): collection = PuzzlesCollection() with open( INPUT_FILES_ROOT. child('parser_test_variant_type_specified_puzzle2.sok') ) as t: SOKFileFormat.read(t, collection, Variant.TRIOBAN) assert collection.puzzles[0].variant == Variant.TRIOBAN assert collection.puzzles[1].variant == Variant.HEXOBAN
def it_snapshots_get_the_same_value_as_their_puzzle(self): collection = PuzzlesCollection() with open( INPUT_FILES_ROOT. child('parser_test_variant_type_specified_global.sok') ) as t: SOKFileFormat.read(t, collection, Variant.OCTOBAN) for puzzle in collection.puzzles: for snapshot in puzzle.snapshots: assert snapshot.variant == puzzle.variant
def it_uses_value_from_puzzle_notes_and_ignores_hint_and_collection_notes( self ): collection = PuzzlesCollection() with open( INPUT_FILES_ROOT. child('parser_test_variant_type_specified_puzzle1.sok') ) as t: SOKFileFormat.read(t, collection, Variant.OCTOBAN) assert collection.puzzles[0].variant == Variant.SOKOBAN assert collection.puzzles[1].variant == Variant.HEXOBAN