Пример #1
0
 def test_references(self):
     from bokeh.plotobject import PlotObject
     pobject1 = PlotObject()
     pobject2 = PlotObject()
     pobject3 = PlotObject()
     pobject4 = PlotObject()
     pobject1.pobject2 = pobject2
     pobject1.pobject3 = pobject3
     pobject3.pobject4 = pobject4
     pobject1.properties_with_refs = Mock(return_value=['pobject2', 'pobject3'])
     pobject3.properties_with_refs = Mock(return_value=['pobject4'])
     resultset = set(pobject1.references())
     expectedset = set([pobject1, pobject2, pobject3, pobject4])
     self.assertEqual(resultset, expectedset)
Пример #2
0
    def test_load_json(self):
        from bokeh.plotobject import PlotObject

        cls = PlotObject.get_class("Plot")
        obj = cls.load_json({"id": "test_id", "min_border": 100})
        self.assertEqual(obj._id, "test_id")
        self.assertEqual(obj.title, "")
        self.assertEqual(obj.min_border, 100)

        obj.load_json({"id": "test_id", "title": "xyz"}, instance=obj)
        self.assertEqual(obj._id, "test_id")
        self.assertEqual(obj.title, "xyz")
        self.assertEqual(obj.min_border, 100)
Пример #3
0
    def test_load_json(self):
        from bokeh.plotobject import PlotObject

        cls = PlotObject.get_class("Plot")
        obj = cls.load_json({'id': 'test_id', 'min_border': 100})
        self.assertEqual(obj._id, 'test_id')
        self.assertEqual(obj.title, '')
        self.assertEqual(obj.min_border, 100)

        obj.load_json({'id': 'test_id', 'title': 'xyz'}, instance=obj)
        self.assertEqual(obj._id, 'test_id')
        self.assertEqual(obj.title, 'xyz')
        self.assertEqual(obj.min_border, 100)
Пример #4
0
    def test_load_json(self):
        from bokeh.plotobject import PlotObject

        cls = PlotObject.get_class("Plot")
        obj = cls.load_json({'id': 'test_id', 'min_border': 100})
        self.assertEqual(obj._id, 'test_id')
        self.assertEqual(obj.title, '')
        self.assertEqual(obj.min_border, 100)

        obj.load_json({'id': 'test_id', 'title': 'xyz'}, instance=obj)
        self.assertEqual(obj._id, 'test_id')
        self.assertEqual(obj.title, 'xyz')
        self.assertEqual(obj.min_border, 100)
Пример #5
0
 def test_references(self):
     from bokeh.plotobject import PlotObject
     pobject1 = PlotObject()
     pobject2 = PlotObject()
     pobject3 = PlotObject()
     pobject4 = PlotObject()
     pobject1.pobject2 = pobject2
     pobject1.pobject3 = pobject3
     pobject3.pobject4 = pobject4
     pobject1.properties_with_refs = Mock(
         return_value=['pobject2', 'pobject3'])
     pobject3.properties_with_refs = Mock(return_value=['pobject4'])
     resultset = set(pobject1.references())
     expectedset = set([pobject1, pobject2, pobject3, pobject4])
     self.assertEqual(resultset, expectedset)