Beispiel #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'})
Beispiel #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'})
Beispiel #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'}
        )
Beispiel #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'}
        )
Beispiel #5
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'
            })
Beispiel #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'}
        )
Beispiel #7
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"
         "])")
Beispiel #8
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"
                      "])")
Beispiel #9
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)
Beispiel #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)
Beispiel #11
0
 def test_non_string_frame(self):
     frames = Frames()
     frames.append({})
Beispiel #12
0
 def test_non_string_frame(self):
     frames = Frames()
     frames.append({})