def test_make_dataset_from_sgf(self):
    with tempfile.NamedTemporaryFile() as sgf_file, tempfile.NamedTemporaryFile() as record_file:
        sgf_file.write(TEST_SGF.encode('utf8'))
        sgf_file.seek(0)
        preprocessing.make_dataset_from_sgf(utils_test.BOARD_SIZE, sgf_file.name, record_file.name)
        recovered_data = self.extract_data(record_file.name)
    start_pos = go.Position(utils_test.BOARD_SIZE)
    first_move = coords.from_sgf('fd')
    next_pos = start_pos.play_move(first_move)
    second_move = coords.from_sgf('cf')
    expected_data = [(features.extract_features(utils_test.BOARD_SIZE, start_pos), preprocessing._one_hot(utils_test.BOARD_SIZE, coords.to_flat(utils_test.BOARD_SIZE, first_move)), (- 1)), (features.extract_features(utils_test.BOARD_SIZE, next_pos), preprocessing._one_hot(utils_test.BOARD_SIZE, coords.to_flat(utils_test.BOARD_SIZE, second_move)), (- 1))]
    self.assertEqualData(expected_data, recovered_data)
def test_make_dataset_from_sgf(self):
    with tempfile.NamedTemporaryFile() as sgf_file, tempfile.NamedTemporaryFile() as record_file:
        sgf_file.write(TEST_SGF.encode('utf8'))
        sgf_file.seek(0)
        preprocessing.make_dataset_from_sgf(utils_test.BOARD_SIZE, sgf_file.name, record_file.name)
        recovered_data = self.extract_data(record_file.name)
    start_pos = go.Position(utils_test.BOARD_SIZE)
    first_move = coords.from_sgf('fd')
    next_pos = start_pos.play_move(first_move)
    second_move = coords.from_sgf('cf')
    expected_data = [(features.extract_features(utils_test.BOARD_SIZE, start_pos), preprocessing._one_hot(utils_test.BOARD_SIZE, coords.to_flat(utils_test.BOARD_SIZE, first_move)), (- 1)), (features.extract_features(utils_test.BOARD_SIZE, next_pos), preprocessing._one_hot(utils_test.BOARD_SIZE, coords.to_flat(utils_test.BOARD_SIZE, second_move)), (- 1))]
    self.assertEqualData(expected_data, recovered_data)