def test_store_restore_empty_game(self): store = NamedTemporaryFile(delete=False) store.close() g1 = Game(scores_file=None, store_file=store.name) self.assertTrue(g1.store()) g2 = Game(scores_file=None, store_file=store.name) g2.board.setCell(0, 0, 16) self.assertTrue(g2.restore()) self.assertIn(g2.board.getCell(0, 0), [0, 2, 4]) remove(store.name)
def test_store_restore_empty_game(self): store = NamedTemporaryFile(delete=False) store.close() g1 = Game(scores_file=None, store_file=store.name) self.assertTrue(g1.store()) g2 = Game(scores_file=None, store_file=store.name) g2.board.setCell(0, 0, 16) self.assertTrue(g2.restore()) self.assertIn(g2.board.getCell(0, 0), [0, 2, 4]) remove(store.name)
def start_game(debug=False): """ Start a new game. If ``debug`` is set to ``True``, the game object is returned and the game loop isn't fired. """ args = parse_cli_args() if args['version']: print_version_and_exit() if args['rules']: print_rules_and_exit() game = Game(**args) if args['resume']: game.restore() if debug: return game return game.loop()
def start_game(debug=False): """ Start a new game. If ``debug`` is set to ``True``, the game object is returned and the game loop isn't fired. """ args = parse_cli_args() if args['version']: print_version_and_exit() if args['rules']: print_rules_and_exit() game = Game(**args) if args['resume']: game.restore() if debug: return game return game.loop()
def test_restore_fail_return_false(self): store_name = '/i/dont/%s/exist/%s' % (uuid4(), uuid4()) g = Game(scores_file=None, store_file=store_name) self.assertFalse(g.restore())
def test_restore_fail_return_false(self): store_name = '/i/dont/%s/exist/%s' % (uuid4(), uuid4()) g = Game(scores_file=None, store_file=store_name) self.assertFalse(g.restore())