コード例 #1
0
    def test_find_candidate(self):
        root = self.build_tree()
        result = changes.find_candidate(root, 'i', [])[0]
        self.assertEqual(u'n1i', result.text)

        n2c = Node('n3c', label=['200', '2', 'i', 'i'])
        n2 = find(root, '200-2')
        n2.children = [n2c]

        result = changes.find_candidate(root, 'i', [])[0]
        self.assertEqual(result.label, ['200', '2', 'i', 'i'])
コード例 #2
0
    def test_find_candidate(self):
        root = self.build_tree()
        result = changes.find_candidate(root, "i", [])[0]
        self.assertEqual(u"n1i", result.text)

        n2c = Node("n3c", label=["200", "2", "i", "i"])
        n2 = find(root, "200-2")
        n2.children = [n2c]

        result = changes.find_candidate(root, "i", [])[0]
        self.assertEqual(result.label, ["200", "2", "i", "i"])
コード例 #3
0
    def test_find_candidate(self):
        root = self.build_tree()
        result = changes.find_candidate(root, 'i', [])[0]
        self.assertEqual(u'n1i', result.text)

        n2c = Node('n3c', label=['200', '2', 'i', 'i'])
        n2 = find(root, '200-2')
        n2.children = [n2c]

        result = changes.find_candidate(root, 'i', [])[0]
        self.assertEqual(result.label, ['200', '2', 'i', 'i'])
コード例 #4
0
def test_find_candidate():
    root = _build_tree()
    result = changes.find_candidate(root, 'i', [])[0]
    assert 'n1i' == result.text

    n2c = Node('n3c', label=['200', '2', 'i', 'i'])
    n2 = find(root, '200-2')
    n2.children = [n2c]

    result = changes.find_candidate(root, 'i', [])[0]
    assert result.label == ['200', '2', 'i', 'i']
コード例 #5
0
    def test_find_candidate_impossible_label(self):
        n1 = Node("", label=["200", "1"])
        n1a = Node("", label=["200", "1", "a"])

        n1a1i = Node("", label=["200", "1", "a", "1", "i"])
        n1a.children = [n1a1i]

        n1b = Node("", label=["200", "1", "b"])
        n1i = Node("", label=["200", "1", "i"])
        n1.children = [n1a, n1b, n1i]

        root = Node("root", label=["200"], children=[n1])
        candidate = changes.find_candidate(root, "i", ["200-1-a", "200-1-b"])[0]

        self.assertEqual(candidate.label, ["200", "1", "i"])
コード例 #6
0
    def test_find_candidate_impossible_label(self):
        n1 = Node('', label=['200', '1'])
        n1a = Node('', label=['200', '1', 'a'])

        n1a1i = Node('', label=['200', '1', 'a', '1', 'i'])
        n1a.children = [n1a1i]

        n1b = Node('', label=['200', '1', 'b'])
        n1i = Node('', label=['200', '1', 'i'])
        n1.children = [n1a, n1b, n1i]

        root = Node('root', label=['200'], children=[n1])
        candidate = changes.find_candidate(root, 'i',
                                           ['200-1-a', '200-1-b'])[0]

        self.assertEqual(candidate.label, ['200', '1', 'i'])
コード例 #7
0
    def test_find_candidate_impossible_label(self):
        n1 = Node('', label=['200', '1'])
        n1a = Node('', label=['200', '1', 'a'])

        n1a1i = Node('', label=['200', '1', 'a', '1', 'i'])
        n1a.children = [n1a1i]

        n1b = Node('', label=['200', '1', 'b'])
        n1i = Node('', label=['200', '1', 'i'])
        n1.children = [n1a, n1b, n1i]

        root = Node('root', label=['200'], children=[n1])
        candidate = changes.find_candidate(
            root, 'i', ['200-1-a', '200-1-b'])[0]

        self.assertEqual(candidate.label, ['200', '1', 'i'])
コード例 #8
0
 def test_not_find_candidate(self):
     root = self.build_tree()
     result = changes.find_candidate(root, 'j', [])
     self.assertEqual(result, [])
コード例 #9
0
 def test_not_find_candidate(self):
     root = self.build_tree()
     result = changes.find_candidate(root, "j", [])
     self.assertEqual(result, [])
コード例 #10
0
def test_not_find_candidate():
    root = _build_tree()
    result = changes.find_candidate(root, 'j', [])
    assert result == []