コード例 #1
0
ファイル: sgf_parsing_test.py プロジェクト: exercism/python
 def test_upper_and_lowercase_property(self):
     input_string = "(;Aa[b])"
     with self.assertRaises(ValueError) as err:
         parse(input_string)
     self.assertEqual(type(err.exception), ValueError)
     self.assertEqual(err.exception.args[0],
                      "property must be in uppercase")
コード例 #2
0
 def test_multiple_properties(self):
     input_string = '(;A[b]C[d])'
     expected = SgfTree(
         properties={'A': ['b'],
                     'C': ['d']}
     )
     self.assertEqual(parse(input_string), expected)
コード例 #3
0
 def test_multiple_properties(self):
     input_string = '(;A[b]C[d])'
     expected = SgfTree(
         properties={'A': ['b'],
                     'C': ['d']}
     )
     self.assertEqual(parse(input_string), expected)
コード例 #4
0
ファイル: sgf_parsing_test.py プロジェクト: rvsp/python-1
 def test_two_child_trees(self):
     input_string = "(;A[B](;B[C])(;C[D]))"
     expected = SgfTree(
         properties={"A": ["B"]},
         children=[SgfTree({"B": ["C"]}), SgfTree({"C": ["D"]})],
     )
     self.assertEqual(parse(input_string), expected)
コード例 #5
0
 def test_two_child_trees(self):
     input_string = '(;A[B](;B[C])(;C[D]))'
     expected = SgfTree(
         properties={'A': ['B']},
         children=[SgfTree({'B': ['C']}),
                   SgfTree({'C': ['D']})])
     self.assertEqual(parse(input_string), expected)
コード例 #6
0
ファイル: test.py プロジェクト: sjl421/python-12
 def test_two_nodes(self):
     input_string = '(;A[B];B[C])'
     expected = SgfTree(
         properties={'A': ['B']},
         children=[
             SgfTree({'B': ['C']})
         ]
     )
     self.assertEqual(parse(input_string), expected)
コード例 #7
0
ファイル: sgf_parsing_test.py プロジェクト: fortrieb/python
 def test_two_nodes(self):
     input_string = '(;A[B];B[C])'
     expected = SgfTree(
         properties={'A': ['B']},
         children=[
             SgfTree({'B': ['C']})
         ]
     )
     self.assertEqual(parse(input_string), expected)
コード例 #8
0
ファイル: sgf_parsing_test.py プロジェクト: fortrieb/python
 def test_two_child_trees(self):
     input_string = '(;A[B](;B[C])(;C[D]))'
     expected = SgfTree(
         properties={'A': ['B']},
         children=[
             SgfTree({'B': ['C']}),
             SgfTree({'C': ['D']}),
         ]
     )
     self.assertEqual(parse(input_string), expected)
コード例 #9
0
ファイル: sgf_parsing_test.py プロジェクト: fortrieb/python
 def test_upper_and_lowercase_property(self):
     input_string = '(;Aa[b])'
     with self.assertRaisesWithMessage(ValueError):
         parse(input_string)
コード例 #10
0
ファイル: sgf_parsing_test.py プロジェクト: fortrieb/python
 def test_properties_without_delimiter(self):
     input_string = '(;A)'
     with self.assertRaisesWithMessage(ValueError):
         parse(input_string)
コード例 #11
0
ファイル: sgf_parsing_test.py プロジェクト: exercism/python
 def test_tree_with_no_nodes(self):
     input_string = "()"
     with self.assertRaises(ValueError) as err:
         parse(input_string)
     self.assertEqual(type(err.exception), ValueError)
     self.assertEqual(err.exception.args[0], "tree with no nodes")
コード例 #12
0
 def test_escaped_property(self):
     input_string = "(;A[\]b\nc\nd\t\te \n\]])"
     expected = SgfTree(properties={"A": ["]b\nc\nd  e \n]"]})
     self.assertEqual(parse(input_string), expected)
コード例 #13
0
 def test_two_nodes(self):
     input_string = "(;A[B];B[C])"
     expected = SgfTree(properties={"A": ["B"]},
                        children=[SgfTree({"B": ["C"]})])
     self.assertEqual(parse(input_string), expected)
コード例 #14
0
ファイル: sgf_parsing_test.py プロジェクト: exercism/python
 def test_properties_without_delimiter(self):
     input_string = "(;A)"
     with self.assertRaises(ValueError) as err:
         parse(input_string)
     self.assertEqual(type(err.exception), ValueError)
     self.assertEqual(err.exception.args[0], "properties without delimiter")
コード例 #15
0
ファイル: sgf_parsing_test.py プロジェクト: fortrieb/python
 def test_multiple_property_values(self):
     input_string = '(;A[b][c][d])'
     expected = SgfTree(
         properties={'A': ['b', 'c', 'd']}
     )
     self.assertEqual(parse(input_string), expected)
コード例 #16
0
 def test_node_without_tree(self):
     input_string = ";"
     with self.assertRaisesWithMessage(ValueError):
         parse(input_string)
コード例 #17
0
ファイル: sgf_parsing_test.py プロジェクト: fortrieb/python
 def test_empty_input(self):
     input_string = ''
     with self.assertRaisesWithMessage(ValueError):
         parse(input_string)
コード例 #18
0
ファイル: test.py プロジェクト: sjl421/python-12
 def test_all_lowercase_property(self):
     input_string = '(;a[b])'
     with self.assertRaisesWithMessage(ValueError):
         parse(input_string)
コード例 #19
0
ファイル: test.py プロジェクト: sjl421/python-12
 def test_single_node_tree(self):
     input_string = '(;A[B])'
     expected = SgfTree(properties={'A': ['B']})
     self.assertEqual(parse(input_string), expected)
コード例 #20
0
 def test_node_invalid_tree(self):
     input_string = "(A;)"
     with self.assertRaisesWithMessage(ValueError):
         parse(input_string)
コード例 #21
0
ファイル: sgf_parsing_test.py プロジェクト: exercism/python
 def test_node_without_tree(self):
     input_string = ";"
     with self.assertRaises(ValueError) as err:
         parse(input_string)
     self.assertEqual(type(err.exception), ValueError)
     self.assertEqual(err.exception.args[0], "tree missing")
コード例 #22
0
 def test_single_node_tree(self):
     input_string = "(;A[B])"
     expected = SgfTree(properties={"A": ["B"]})
     self.assertEqual(parse(input_string), expected)
コード例 #23
0
 def test_properties_without_delimiter(self):
     input_string = "(;A)"
     with self.assertRaisesWithMessage(ValueError):
         parse(input_string)
コード例 #24
0
ファイル: sgf_parsing_test.py プロジェクト: fortrieb/python
 def test_escaped_property(self):
     input_string = '(;A[\]b\nc\nd\t\te \n\]])'
     expected = SgfTree(
         properties={'A': [']b\nc\nd  e \n]']}
     )
     self.assertEqual(parse(input_string), expected)
コード例 #25
0
from sgf_parsing import parse, SgfTree

#expected = SgfTree(properties={'A': ['B']})
#print(expected)

input_string = '(;a[b])'
parse(input_string)
コード例 #26
0
 def test_tree_with_no_nodes(self):
     input_string = "()"
     with self.assertRaisesWithMessage(ValueError):
         parse(input_string)
コード例 #27
0
ファイル: test.py プロジェクト: sjl421/python-12
 def test_multiple_property_values(self):
     input_string = '(;A[b][c][d])'
     expected = SgfTree(
         properties={'A': ['b', 'c', 'd']}
     )
     self.assertEqual(parse(input_string), expected)
コード例 #28
0
 def test_node_without_properties(self):
     input_string = "(;)"
     expected = SgfTree()
     self.assertEqual(parse(input_string), expected)
コード例 #29
0
ファイル: test.py プロジェクト: sjl421/python-12
 def test_escaped_property(self):
     input_string = '(;A[\]b\nc\nd\t\te \n\]])'
     expected = SgfTree(
         properties={'A': [']b\nc\nd  e \n]']}
     )
     self.assertEqual(parse(input_string), expected)
コード例 #30
0
 def test_multiple_properties(self):
     input_string = "(;A[b]C[d])"
     expected = SgfTree(properties={"A": ["b"], "C": ["d"]})
     self.assertEqual(parse(input_string), expected)
コード例 #31
0
ファイル: sgf_parsing_test.py プロジェクト: fortrieb/python
 def test_tree_with_no_nodes(self):
     input_string = '()'
     with self.assertRaisesWithMessage(ValueError):
         parse(input_string)
コード例 #32
0
 def test_upper_and_lowercase_property(self):
     input_string = "(;Aa[b])"
     with self.assertRaisesWithMessage(ValueError):
         parse(input_string)
コード例 #33
0
ファイル: sgf_parsing_test.py プロジェクト: fortrieb/python
 def test_node_without_tree(self):
     input_string = ';'
     with self.assertRaisesWithMessage(ValueError):
         parse(input_string)
コード例 #34
0
 def test_multiple_property_values(self):
     input_string = "(;A[b][c][d])"
     expected = SgfTree(properties={"A": ["b", "c", "d"]})
     self.assertEqual(parse(input_string), expected)
コード例 #35
0
ファイル: sgf_parsing_test.py プロジェクト: fortrieb/python
 def test_node_without_properties(self):
     input_string = '(;)'
     expected = SgfTree()
     self.assertEqual(parse(input_string), expected)
コード例 #36
0
 def test_empty_input(self):
     input_string = ""
     with self.assertRaisesWithMessage(ValueError):
         parse(input_string)
コード例 #37
0
ファイル: sgf_parsing_test.py プロジェクト: fortrieb/python
 def test_single_node_tree(self):
     input_string = '(;A[B])'
     expected = SgfTree(properties={'A': ['B']})
     self.assertEqual(parse(input_string), expected)