コード例 #1
0
 def test_from_list_no_root(self):
     """Verify an error occurs when the tree has no root."""
     a = MockDocumentSkip(EMPTY)
     a.prefix = 'A'
     a.parent = 'B'
     b = MockDocumentSkip(EMPTY)
     b.prefix = 'B'
     b.parent = 'A'
     docs = [a, b]
     self.assertRaises(DoorstopError, Tree.from_list, docs)
コード例 #2
0
ファイル: test_tree.py プロジェクト: dornerworks/doorstop
 def test_from_list_no_root(self):
     """Verify an error occurs when the tree has no root."""
     a = MockDocumentSkip(EMPTY)
     a.prefix = 'A'
     a.parent = 'B'
     b = MockDocumentSkip(EMPTY)
     b.prefix = 'B'
     b.parent = 'A'
     docs = [a, b]
     self.assertRaises(DoorstopError, Tree.from_list, docs)
コード例 #3
0
    def test_from_list_missing_parent(self):
        """Verify an error occurs when a node has a missing parent."""

        a = MockDocumentSkip(EMPTY)
        a.prefix = 'A'
        b = MockDocumentSkip(EMPTY)
        b.prefix = 'B'
        b.parent = 'A'
        c = MockDocumentSkip(EMPTY)
        c.prefix = 'C'
        c.parent = '?'
        docs = [a, b, c]
        self.assertRaises(DoorstopError, Tree.from_list, docs)
コード例 #4
0
ファイル: test_tree.py プロジェクト: dornerworks/doorstop
    def test_from_list_missing_parent(self):
        """Verify an error occurs when a node has a missing parent."""

        a = MockDocumentSkip(EMPTY)
        a.prefix = 'A'
        b = MockDocumentSkip(EMPTY)
        b.prefix = 'B'
        b.parent = 'A'
        c = MockDocumentSkip(EMPTY)
        c.prefix = 'C'
        c.parent = '?'
        docs = [a, b, c]
        self.assertRaises(DoorstopError, Tree.from_list, docs)
コード例 #5
0
 def test_from_list(self):
     """Verify a tree can be created from a list."""
     a = MockDocumentSkip(EMPTY)
     a.prefix = 'A'
     b = MockDocumentSkip(EMPTY)
     b.prefix = 'B'
     b.parent = 'A'
     c = MockDocumentSkip(EMPTY)
     c.prefix = 'C'
     c.parent = 'B'
     docs = [a, b, c]
     tree = Tree.from_list(docs)
     self.assertEqual(3, len(tree))
     self.assertTrue(tree.validate())
コード例 #6
0
ファイル: test_tree.py プロジェクト: dornerworks/doorstop
 def test_from_list(self):
     """Verify a tree can be created from a list."""
     a = MockDocumentSkip(EMPTY)
     a.prefix = 'A'
     b = MockDocumentSkip(EMPTY)
     b.prefix = 'B'
     b.parent = 'A'
     c = MockDocumentSkip(EMPTY)
     c.prefix = 'C'
     c.parent = 'B'
     docs = [a, b, c]
     tree = Tree.from_list(docs)
     self.assertEqual(3, len(tree))
     self.assertTrue(tree.validate())