Example #1
0
    def test_frame_only_attrs(self):
        frames = Frames()
        frames.append({})

        # It's OK if this needs to change, but we should check *something*.
        self.assertEqual(
            frames[0]._get_valid_attributes(),
            {'group', 'name', 'data', 'layout', 'baseframe', 'traces'})
Example #2
0
    def test_deeply_nested_layout_attributes(self):
        frames = Frames()
        frames.append({})
        frames[0].layout.xaxis.showexponent = 'all'

        # It's OK if this needs to change, but we should check *something*.
        self.assertEqual(frames[0].layout.font._get_valid_attributes(),
                         {'color', 'family', 'size'})
Example #3
0
    def test_frame_only_attrs(self):
        frames = Frames()
        frames.append({})

        # It's OK if this needs to change, but we should check *something*.
        self.assertEqual(
            frames[0]._get_valid_attributes(),
            {'group', 'name', 'data', 'layout', 'baseframe', 'traces'}
        )
Example #4
0
    def test_deeply_nested_layout_attributes(self):
        frames = Frames()
        frames.append({})
        frames[0].layout.xaxis.showexponent = 'all'

        # It's OK if this needs to change, but we should check *something*.
        self.assertEqual(
            frames[0].layout.font._get_valid_attributes(),
            {'color', 'family', 'size'}
        )
Example #5
0
    def test_instantiation(self):

        native_frames = [
            {},
            {'data': []},
            'foo',
            {'data': [], 'group': 'baz', 'layout': {}, 'name': 'hoopla'}
        ]

        Frames(native_frames)
        Frames()
Example #6
0
    def test_deeply_nested_data_attributes(self):
        frames = Frames()
        frames.append({})
        frames[0].data = [Bar()]
        frames[0].data[0].marker.color = 'red'

        # It's OK if this needs to change, but we should check *something*.
        self.assertEqual(
            frames[0].data[0].marker.line._get_valid_attributes(), {
                'colorsrc', 'autocolorscale', 'cmin', 'colorscale', 'color',
                'reversescale', 'width', 'cauto', 'widthsrc', 'cmax'
            })
Example #7
0
    def test_deeply_nested_data_attributes(self):
        frames = Frames()
        frames.append({})
        frames[0].data = [Bar()]
        frames[0].data[0].marker.color = 'red'

        # It's OK if this needs to change, but we should check *something*.
        self.assertEqual(
            frames[0].data[0].marker.line._get_valid_attributes(),
            {'colorsrc', 'autocolorscale', 'cmin', 'colorscale', 'color',
             'reversescale', 'width', 'cauto', 'widthsrc', 'cmax'}
        )
Example #8
0
    def test_non_string_frame(self):
        frames = Frames()
        frames.append({})

        with self.assertRaises(exceptions.PlotlyListEntryError):
            frames.append([])

        with self.assertRaises(exceptions.PlotlyListEntryError):
            frames.append(0)
Example #9
0
    def test_instantiation(self):

        native_frames = [
            {},
            {
                "data": []
            },
            "foo",
            {
                "data": [],
                "group": "baz",
                "layout": {},
                "name": "hoopla"
            },
        ]

        Frames(native_frames)
        Frames()
Example #10
0
    def test_non_string_frame(self):
        frames = Frames()
        frames.append({})

        with self.assertRaises(exceptions.PlotlyListEntryError):
            frames.append([])

        with self.assertRaises(exceptions.PlotlyListEntryError):
            frames.append(0)
Example #11
0
 def test_string_frame(self):
     frames = Frames()
     frames.append({'group': 'baz', 'data': []})
     frames.append('foobar')
     self.assertEqual(frames[1], 'foobar')
     self.assertEqual(
         frames.to_string(), "Frames([\n"
         "    dict(\n"
         "        data=Data(),\n"
         "        group='baz'\n"
         "    ),\n"
         "    'foobar'\n"
         "])")
Example #12
0
 def test_string_frame(self):
     frames = Frames()
     frames.append({'group': 'baz', 'data': []})
     frames.append('foobar')
     self.assertEqual(frames[1], 'foobar')
     self.assertEqual(frames.to_string(),
                      "Frames([\n"
                      "    dict(\n"
                      "        data=Data(),\n"
                      "        group='baz'\n"
                      "    ),\n"
                      "    'foobar'\n"
                      "])")
Example #13
0
 def test_non_string_frame(self):
     frames = Frames()
     frames.append({})
Example #14
0
 def test_non_string_frame(self):
     frames = Frames()
     frames.append({})