Files
@ cfcff53c74e6
Branch filter:
Location: Diana/src/tests/testSgfParser.py - annotation
cfcff53c74e6
826 B
text/x-python
little property refactoring
f0b8120281b9 f0b8120281b9 f0b8120281b9 f0b8120281b9 b66f5379b832 cfcff53c74e6 f0b8120281b9 f0b8120281b9 f0b8120281b9 f0b8120281b9 b66f5379b832 cfcff53c74e6 cfcff53c74e6 cfcff53c74e6 cfcff53c74e6 cfcff53c74e6 cfcff53c74e6 cfcff53c74e6 cfcff53c74e6 cfcff53c74e6 cfcff53c74e6 f0b8120281b9 f0b8120281b9 f0b8120281b9 f0b8120281b9 f0b8120281b9 f0b8120281b9 f0b8120281b9 f0b8120281b9 f0b8120281b9 f0b8120281b9 f0b8120281b9 f0b8120281b9 f0b8120281b9 f0b8120281b9 | import unittest
from unittest import TestCase
import os
from sgfParser.collection import Collection
from sgfParser.property import Property
dataDir=os.path.join(os.path.dirname(__file__), "data")
class TestProperty(TestCase):
def testName(self):
self.assertEqual(Property.create("[99]",0), (0,None))
self.assertEqual(Property.create("99[99]",0), (0,None))
i,prop=Property.create("MN[99]",0)
self.assertNotEqual((i,prop), (0,None))
self.assertEqual((i,prop.name), (6,"MN"))
class TestCollection(TestCase):
def testEmptySgf(self):
Collection("(;)")
def testSimpleSgf(self):
with open(os.path.join(dataDir, "simple.sgf")) as f:
Collection(f.read())
def testComplexSgf(self):
with open(os.path.join(dataDir, "kogos.sgf")) as f:
Collection(f.read())
if __name__ == '__main__':
unittest.main()
|