<commit_before>import io

import pytest

from privat import engine
import privat.io


@pytest.mark.asyncio
async def test_save_and_load():
    width = 4
    height = 5
    players = 3

    board1 = engine.Board(width, height, players)

    await board1.play(1, 1)
    await board1.play(2, 2)
    await board1.play(1, 2)
    await board1.play(1, 1)

    save_file = io.StringIO()
    privat.io.save_board(board1, save_file)

    save_file.seek(0)
    board2 = privat.io.load_board(save_file)

    assert board1.width == board2.width
    assert board1.height == board2.height
    assert board1.overall_value == board2.overall_value

    for square1, square2 in zip(board1, board2):<commit_msg>Assuring that loading a saved game sets a correct actual player.<commit_after>import io

import pytest

from privat import engine
import privat.io


@pytest.mark.asyncio
async def test_save_and_load():
    width = 4
    height = 5
    players = 3

    board1 = engine.Board(width, height, players)

    await board1.play(1, 1)
    await board1.play(2, 2)
    await board1.play(1, 2)
    await board1.play(1, 1)

    save_file = io.StringIO()
    privat.io.save_board(board1, save_file)

    save_file.seek(0)
    board2 = privat.io.load_board(save_file)

    assert board1.width == board2.width
    assert board1.height == board2.height
    assert board1.overall_value == board2.overall_value
    assert board1.actual_player.number == board2.actual_player.number

    for square1, square2 in zip(board1, board2):
{'fraction_non_alphanumeric': 0.09647371922821024, 'fraction_numerical': 0.03992015968063872, 'mean_word_length': 3.372093023255814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '301523', 'n_tokens_mistral': 546, 'n_tokens_neox': 525, 'n_words': 128}