Exemplo n.º 1
0
    def test_pd(self):
        a = from_file("tests/2009060321gm-00b9-0000-75b25bcf.xml")
        pd_frame = pd.DataFrame(a.to_paifu())
        assert len(pd_frame) == 53

        a = from_file("tests/2009100718gm-00e1-0000-470654d3.xml")
        pd_frame = pd.DataFrame(a.to_paifu())
        assert len(pd_frame) == 75
Exemplo n.º 2
0
    def test_fin_game(self):
        a = from_file("tests/2009060321gm-00b9-0000-75b25bcf.xml")
        tr = len(a.to_paifu())
        tg = 0
        for i in a.game_list:
            tg += len(i.to_paifu())
        assert tr - tg == 3

        a = from_file("tests/2009100718gm-00e1-0000-470654d3.xml")
        tr = len(a.to_paifu())
        tg = 0
        for i in a.game_list:
            tg += len(i.to_paifu())
        assert tr - tg == 4
Exemplo n.º 3
0
 def test_to_paifu(self):
     a = from_file("tests/2009060321gm-00b9-0000-75b25bcf.xml")
     retlen = 0
     for z in a.game_list:
         for i in z.events:
             ret = i.to_paifu()
             retlen += len(ret)
     assert retlen == 50
Exemplo n.º 4
0
 def test_from_file(self):
     filename = os.path.join("tests", "2009060321gm-00b9-0000-75b25bcf.xml")
     record = from_file(filename)
     assert len(record.game_list) == 1
Exemplo n.º 5
0
 def test_init_to_paifu_sima(self):
     a = from_file("tests/2009100718gm-00e1-0000-470654d3.xml")
     assert len(a.game_list[0].events[0].to_paifu()) == 6
Exemplo n.º 6
0
 def test_init_to_paifu_sanma(self):
     a = from_file("tests/2009060321gm-00b9-0000-75b25bcf.xml")
     assert len(a.game_list[0].events[0].to_paifu()) == 5
def test_command_convert(file_name):
    with open(file_name, "r") as f:
        record = from_file(f)
    commands = to_commands(record, strict=True)
    assert len(commands) > 1
def file_to_commands(file):
    with open(file, "r") as f:
        record = from_file(f)
        commands = to_commands(record)
        return commands
def to_commands_iter(files):
    for file in files:
        with open(file, "r") as f:
            record = from_file(f)
            commands = to_commands(record)
            yield commands