forked from wrongu/RocAlphaGo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_game_converter.py
31 lines (23 loc) · 962 Bytes
/
test_game_converter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from AlphaGo.preprocessing.game_converter import run_game_converter
from AlphaGo.util import sgf_to_gamestate
import unittest
import os
class TestSGFLoading(unittest.TestCase):
def test_ab_aw(self):
with open('tests/test_data/sgf_with_handicap/ab_aw.sgf', 'r') as f:
sgf_to_gamestate(f.read())
class TestCmdlineConverter(unittest.TestCase):
def test_directory_conversion(self):
args = ['--features', 'board,ones,turns_since',
'--outfile', '.tmp.testing.h5',
'--directory', 'tests/test_data/sgf/']
run_game_converter(args)
os.remove('.tmp.testing.h5')
def test_directory_walk(self):
args = ['--features', 'board,ones,turns_since',
'--outfile', '.tmp.testing.h5',
'--directory', 'tests/test_data', '--recurse']
run_game_converter(args)
os.remove('.tmp.testing.h5')
if __name__ == '__main__':
unittest.main()