Esempio n. 1
0
 def test_with_temp_docs(self):
     p1 = SomeModel()
     p2 = SomeModel()
     beu._create_temp_doc([p1, p2])
     beu._dispose_temp_doc([p1, p2])
     assert p1.document is None
     assert p2.document is None
Esempio n. 2
0
 def test_with_temp_docs(self):
     p1 = Model()
     p2 = Model()
     beu._create_temp_doc([p1, p2])
     beu._dispose_temp_doc([p1, p2])
     assert p1.document is None
     assert p2.document is None
Esempio n. 3
0
 def test_with_docs(self):
     d1 = Document()
     d2 = Document()
     p1 = SomeModel()
     d1.add_root(p1)
     p2 = OtherModel(child=SomeModel())
     d2.add_root(p2.child)
     beu._create_temp_doc([p1, p2])
     beu._dispose_temp_doc([p1, p2])
     assert p1.document is d1
     assert p2.document is None
     assert p2.child.document is d2
Esempio n. 4
0
 def test_with_docs(self):
     d1 = Document()
     d2 = Document()
     p1 = Model()
     d1.add_root(p1)
     p2 = SomeModelInTestObjects(child=Model())
     d2.add_root(p2.child)
     beu._create_temp_doc([p1, p2])
     beu._dispose_temp_doc([p1, p2])
     assert p1.document is d1
     assert p2.document is None
     assert p2.child.document is d2
Esempio n. 5
0
    def test_top_level_same_doc(self):
        d = Document()
        p1 = SomeModel()
        p2 = SomeModel()
        d.add_root(p1)
        d.add_root(p2)
        beu._create_temp_doc([p1, p2])
        assert isinstance(p1.document, Document)
        assert p1.document is not d
        assert isinstance(p2.document, Document)
        assert p2.document is not d

        assert p2.document == p1.document
Esempio n. 6
0
    def test_top_level_same_doc(self):
        d = Document()
        p1 = Model()
        p2 = Model()
        d.add_root(p1)
        d.add_root(p2)
        beu._create_temp_doc([p1, p2])
        assert isinstance(p1.document, Document)
        assert p1.document is not d
        assert isinstance(p2.document, Document)
        assert p2.document is not d

        assert p2.document == p1.document
Esempio n. 7
0
    def test_top_level_different_doc(self):
        d1 = Document()
        d2 = Document()
        p1 = SomeModel()
        p2 = SomeModel()
        d1.add_root(p1)
        d2.add_root(p2)
        beu._create_temp_doc([p1, p2])
        assert isinstance(p1.document, Document)
        assert p1.document is not d1
        assert isinstance(p2.document, Document)
        assert p2.document is not d2

        assert p2.document == p1.document
Esempio n. 8
0
    def test_top_level_different_doc(self):
        d1 = Document()
        d2 = Document()
        p1 = Model()
        p2 = Model()
        d1.add_root(p1)
        d2.add_root(p2)
        beu._create_temp_doc([p1, p2])
        assert isinstance(p1.document, Document)
        assert p1.document is not d1
        assert isinstance(p2.document, Document)
        assert p2.document is not d2

        assert p2.document == p1.document
Esempio n. 9
0
    def test_child_docs(self):
        d = Document()
        p1 = SomeModel()
        p2 = OtherModel(child=SomeModel())
        d.add_root(p2.child)
        beu._create_temp_doc([p1, p2])

        assert isinstance(p1.document, Document)
        assert p1.document is not d
        assert isinstance(p2.document, Document)
        assert p2.document is not d
        assert isinstance(p2.child.document, Document)
        assert p2.child.document is not d

        assert p2.document == p1.document
        assert p2.document == p2.child.document
Esempio n. 10
0
    def test_child_docs(self):
        d = Document()
        p1 = Model()
        p2 = SomeModelInTestObjects(child=Model())
        d.add_root(p2.child)
        beu._create_temp_doc([p1, p2])

        assert isinstance(p1.document, Document)
        assert p1.document is not d
        assert isinstance(p2.document, Document)
        assert p2.document is not d
        assert isinstance(p2.child.document, Document)
        assert p2.child.document is not d

        assert p2.document == p1.document
        assert p2.document == p2.child.document
Esempio n. 11
0
 def test_no_docs(self):
     p1 = SomeModel()
     p2 = SomeModel()
     beu._create_temp_doc([p1, p2])
     assert isinstance(p1.document, Document)
     assert isinstance(p2.document, Document)
Esempio n. 12
0
 def test_no_docs(self):
     p1 = Model()
     p2 = Model()
     beu._create_temp_doc([p1, p2])
     assert isinstance(p1.document, Document)
     assert isinstance(p2.document, Document)