コード例 #1
0
    def test_flat_vals_006(self):

        gchart = JoogleChart(self.df1)
        gchart.add_chart_options(options={"c": 3}, a=1, b=2)

        expected = {"a": 1, "b": 2, "c": 3}
        actual = gchart.charts[0].chart_options

        self.assertEqual(expected, actual)
コード例 #2
0
    def test_flat_vals_004(self):

        gchart = JoogleChart(self.df1)
        gchart.add_chart_options({"a": 1})

        expected = {"a": 1}
        actual = gchart.charts[0].chart_options

        self.assertEqual(expected, actual)
コード例 #3
0
    def test_nested_vals_001(self):

        # Add a nested dictionary with underscore notation in kwarg
        gchart = JoogleChart(self.df1)
        gchart.add_chart_options(a_b=1)

        expected = {"a": {"b": 1}}
        actual = gchart.charts[0].chart_options

        self.assertEqual(expected, actual)
コード例 #4
0
    def test_flat_vals_007(self):

        gchart = JoogleChart(self.df1)
        gchart.add_chart_options(a=1)
        gchart.add_chart_options({"b": 2, "c": 4})

        expected = {"a": 1, "b": 2, "c": 4}
        actual = gchart.charts[0].chart_options

        self.assertEqual(expected, actual)
コード例 #5
0
    def test_nested_vals_004(self):
        # Add a nested dictionary with three levels

        gchart = JoogleChart(self.df1)
        gchart.add_chart_options(a_b_c=1)

        expected = {"a": {"b": {"c": 1}}}
        actual = gchart.charts[0].chart_options

        self.assertEqual(expected, actual)
コード例 #6
0
    def test_nested_vals_010(self):

        # Add kwargs with two nested attributes on the same level in same call
        gchart = JoogleChart(self.df1)
        gchart.add_chart_options(a=0, b_x=4, b_y=5)

        expected = {"a": 0, "b": {"x": 4, "y": 5}}
        actual = gchart.charts[0].chart_options

        self.assertEqual(expected, actual)
コード例 #7
0
    def test_nested_vals_011(self):

        # Add dictionary that has multiple items at lower level
        gchart = JoogleChart(self.df1)
        gchart.add_chart_options(a=0, b_x=4)
        gchart.add_chart_options(b_y=5)

        expected = {"a": 0, "b": {"x": 4, "y": 5}}
        actual = gchart.charts[0].chart_options

        self.assertEqual(expected, actual)
コード例 #8
0
    def test_nested_vals_009(self):

        # Add dictionary that has multiple items at lower level
        gchart = JoogleChart(self.df1)
        gchart.add_chart_options(a_b=2)
        gchart.add_chart_options({"a": {"c": 3, "d": 4}})

        expected = {"a": {"b": 2, "c": 3, "d": 4}}
        actual = gchart.charts[0].chart_options

        self.assertEqual(expected, actual)
コード例 #9
0
    def test_nested_vals_008(self):

        # Overwrite one nested item scalar with another
        gchart = JoogleChart(self.df1)
        gchart.add_chart_options(a_b=2)
        gchart.add_chart_options(a_b=1)

        expected = {"a": {"b": 1}}
        actual = gchart.charts[0].chart_options

        self.assertEqual(expected, actual)
コード例 #10
0
    def test_nested_vals_007(self):

        # Overwrite a nested dictionary with a scalar
        gchart = JoogleChart(self.df1)
        gchart.add_chart_options(a_b_c=2)
        gchart.add_chart_options(a_b=1)

        expected = {"a": {"b": 1}}
        actual = gchart.charts[0].chart_options

        self.assertEqual(expected, actual)
コード例 #11
0
    def test_nested_vals_005(self):
        # Combine two nested dictionaries

        gchart = JoogleChart(self.df1)
        gchart.add_chart_options(a_b=1)
        gchart.add_chart_options(a_c=2)

        expected = {"a": {"b": 1, "c": 2}}
        actual = gchart.charts[0].chart_options

        self.assertEqual(expected, actual)
コード例 #12
0
    def test_nested_vals_003(self):

        # Add a nested dictionary with dot notation in key

        gchart = JoogleChart(self.df1)
        gchart.add_chart_options({"a.b": 1})

        expected = {"a": {"b": 1}}
        actual = gchart.charts[0].chart_options

        self.assertEqual(expected, actual)