예제 #1
0
파일: test_objects.py 프로젝트: rbtr/bokeh
 def test_list_of_plot_object(self):
     p1 = PlotObject()
     p2 = PlotObject()
     self.assertIs(p1.document, None)
     self.assertIs(p2.document, None)
     with _ModelInDocument([p1, p2]):
         self.assertIsNot(p1.document, None)
         self.assertIsNot(p2.document, None)
     self.assertIs(p1.document, None)
     self.assertIs(p2.document, None)
예제 #2
0
 def test_list_of_plot_object(self):
     p1 = PlotObject()
     p2 = PlotObject()
     self.assertIs(p1.document, None)
     self.assertIs(p2.document, None)
     with _ModelInDocument([p1, p2]):
         self.assertIsNot(p1.document, None)
         self.assertIsNot(p2.document, None)
     self.assertIs(p1.document, None)
     self.assertIs(p2.document, None)
예제 #3
0
 def test_uses_doc_precedent(self):
     doc = Document()
     p1 = PlotObject()
     p2 = PlotObject()
     self.assertIs(p1.document, None)
     self.assertIs(p2.document, None)
     with _ModelInDocument([p1, p2, doc]):
         self.assertIsNot(p1.document, None)
         self.assertIsNot(p2.document, None)
         self.assertIs(p1.document, doc)
         self.assertIs(p2.document, doc)
     self.assertIs(p1.document, None)
     self.assertIs(p2.document, None)
예제 #4
0
파일: test_objects.py 프로젝트: rbtr/bokeh
 def test_uses_doc_precedent(self):
     doc = Document()
     p1 = PlotObject()
     p2 = PlotObject()
     self.assertIs(p1.document, None)
     self.assertIs(p2.document, None)
     with _ModelInDocument([p1, p2, doc]):
         self.assertIsNot(p1.document, None)
         self.assertIsNot(p2.document, None)
         self.assertIs(p1.document, doc)
         self.assertIs(p2.document, doc)
     self.assertIs(p1.document, None)
     self.assertIs(p2.document, None)
예제 #5
0
 def test_uses_precedent_from_child(self):
     doc = Document()
     p1 = PlotObject()
     p2 = SomeModelInTestObjects(child=PlotObject())
     doc.add_root(p2.child)
     self.assertIs(p1.document, None)
     self.assertIs(p2.document, None)
     self.assertIs(p2.child.document, doc)
     with _ModelInDocument([p1, p2]):
         self.assertIsNot(p1.document, None)
         self.assertIsNot(p2.document, None)
         self.assertIs(p1.document, doc)
         self.assertIs(p2.document, doc)
     self.assertIs(p1.document, None)
     self.assertIs(p2.document, None)
     self.assertIsNot(p2.child.document, None)
     self.assertIs(p2.child.document, doc)
예제 #6
0
 def test_uses_precedent(self):
     # it's deliberate that the doc is on p2, so _ModelInDocument
     # has to be smart about looking for a doc anywhere in the list
     # before it starts inventing new documents
     doc = Document()
     p1 = PlotObject()
     p2 = PlotObject()
     doc.add_root(p2)
     self.assertIs(p1.document, None)
     self.assertIsNot(p2.document, None)
     with _ModelInDocument([p1, p2]):
         self.assertIsNot(p1.document, None)
         self.assertIsNot(p2.document, None)
         self.assertIs(p1.document, doc)
         self.assertIs(p2.document, doc)
     self.assertIs(p1.document, None)
     self.assertIsNot(p2.document, None)
예제 #7
0
파일: test_objects.py 프로젝트: rbtr/bokeh
 def test_uses_precedent_from_child(self):
     doc = Document()
     p1 = PlotObject()
     p2 = SomeModelInTestObjects(child=PlotObject())
     doc.add_root(p2.child)
     self.assertIs(p1.document, None)
     self.assertIs(p2.document, None)
     self.assertIs(p2.child.document, doc)
     with _ModelInDocument([p1, p2]):
         self.assertIsNot(p1.document, None)
         self.assertIsNot(p2.document, None)
         self.assertIs(p1.document, doc)
         self.assertIs(p2.document, doc)
     self.assertIs(p1.document, None)
     self.assertIs(p2.document, None)
     self.assertIsNot(p2.child.document, None)
     self.assertIs(p2.child.document, doc)
예제 #8
0
파일: test_objects.py 프로젝트: rbtr/bokeh
 def test_uses_precedent(self):
     # it's deliberate that the doc is on p2, so _ModelInDocument
     # has to be smart about looking for a doc anywhere in the list
     # before it starts inventing new documents
     doc = Document()
     p1 = PlotObject()
     p2 = PlotObject()
     doc.add_root(p2)
     self.assertIs(p1.document, None)
     self.assertIsNot(p2.document, None)
     with _ModelInDocument([p1, p2]):
         self.assertIsNot(p1.document, None)
         self.assertIsNot(p2.document, None)
         self.assertIs(p1.document, doc)
         self.assertIs(p2.document, doc)
     self.assertIs(p1.document, None)
     self.assertIsNot(p2.document, None)
예제 #9
0
 def test_single_plot_object(self):
     p = PlotObject()
     self.assertIs(p.document, None)
     with _ModelInDocument(p):
         self.assertIsNot(p.document, None)
     self.assertIs(p.document, None)
예제 #10
0
파일: test_objects.py 프로젝트: rbtr/bokeh
 def test_single_plot_object(self):
     p = PlotObject()
     self.assertIs(p.document, None)
     with _ModelInDocument(p):
         self.assertIsNot(p.document, None)
     self.assertIs(p.document, None)