コード例 #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
コード例 #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
コード例 #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
コード例 #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
コード例 #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
コード例 #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
コード例 #7
0
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
コード例 #8
0
def file_to_commands(file):
    with open(file, "r") as f:
        record = from_file(f)
        commands = to_commands(record)
        return commands
コード例 #9
0
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