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

        a = MockDocumentSkip(EMPTY)
        a.prefix = 'A'
        b = MockDocumentSkip(EMPTY)
        b.prefix = 'B'
        tree = Tree(a)
        self.assertRaises(DoorstopError, tree._place, b)  # pylint: disable=W0212
コード例 #3
0
ファイル: test_tree.py プロジェクト: pombredanne/doorstop
 def test_palce_empty(self):
     """Verify a document can be placed in an empty tree."""
     tree = build(EMPTY)
     doc = MockDocumentSkip.new(tree, os.path.join(EMPTY, 'temp'), EMPTY,
                                'TEMP')
     tree._place(doc)  # pylint: disable=W0212
     self.assertEqual(1, len(tree))
コード例 #4
0
 def test_palce_empty_no_parent(self):
     """Verify a document with parent cannot be placed in an empty tree."""
     tree = build(EMPTY)
     doc = MockDocumentSkip.new(tree,
                                os.path.join(EMPTY, 'temp'), EMPTY, 'TEMP',
                                parent='REQ')
     self.assertRaises(DoorstopError, tree._place, doc)  # pylint: disable=W0212
コード例 #5
0
ファイル: test_tree.py プロジェクト: PeterDaveHello/doorstop
 def test_palce_empty(self):
     """Verify a document can be placed in an empty tree."""
     tree = build(EMPTY)
     doc = MockDocumentSkip.new(tree,
                                os.path.join(EMPTY, 'temp'), EMPTY, 'TEMP')
     tree._place(doc)  # pylint: disable=W0212
     self.assertEqual(1, len(tree))
コード例 #6
0
ファイル: test_tree.py プロジェクト: pombredanne/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)
コード例 #7
0
ファイル: test_tree.py プロジェクト: PeterDaveHello/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)
コード例 #8
0
ファイル: test_tree.py プロジェクト: PeterDaveHello/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())
コード例 #9
0
ファイル: test_tree.py プロジェクト: pombredanne/doorstop
 def test_from_list_multiple_roots(self):
     """Verify an error occurs when the tree has multiple roots."""
     a = MockDocumentSkip(EMPTY)
     a.prefix = 'A'
     b = MockDocumentSkip(EMPTY)
     b.prefix = 'B'
     docs = [a, b]
     self.assertRaises(DoorstopError, Tree.from_list, docs)
コード例 #10
0
ファイル: test_tree.py プロジェクト: pombredanne/doorstop
    def test_place_no_parent(self):
        """Verify an error occurs when a node is missing a parent."""

        a = MockDocumentSkip(EMPTY)
        a.prefix = 'A'
        b = MockDocumentSkip(EMPTY)
        b.prefix = 'B'
        tree = Tree(a)
        self.assertRaises(DoorstopError, tree._place, b)  # pylint: disable=W0212
コード例 #11
0
ファイル: test_tree.py プロジェクト: PeterDaveHello/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)
コード例 #12
0
ファイル: test_tree.py プロジェクト: pombredanne/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)
コード例 #13
0
ファイル: test_tree.py プロジェクト: pombredanne/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())