Beispiel #1
0
    def test_3(self):
        """
        interpolate_dict(a, b) interpolates nested dicts and list
        """
        i = interpolate.dict({"foo": [2, 12]}, {"foo": [4, 24]})
        self.assertEqual(i(0.5), {"foo": [3, 18]})

        i = interpolate.dict({"foo": {"bar": [2, 12]}}, {"foo": {"bar": [4, 24]}})
        self.assertEqual(i(0.5), {"foo": {"bar": [3, 18]}})
Beispiel #2
0
    def test_2(self):
        """
        interpolate_dict(a, b) merges non-shared properties
        """

        i = interpolate.dict({"foo": 2}, {"foo": 4, "bar": 4})
        self.assertEqual(i(0.5), {"foo": 3, "bar": 4})

        i = interpolate.dict({"foo": 2, "bar": 4}, {"foo": 4})
        self.assertEqual(i(0.5), {"foo": 3, "bar": 4})
Beispiel #3
0
    def test_3(self):
        """
        interpolate_dict(a, b) interpolates nested dicts and list
        """
        i = interpolate.dict( {"foo": [2, 12]},
                              {"foo": [4, 24]})
        self.assertEqual(i(.5), {"foo": [3, 18]})

        i = interpolate.dict( {"foo": {"bar": [2, 12]}},
                              {"foo": {"bar": [4, 24]}})
        self.assertEqual(i(.5), {"foo": {"bar": [3, 18]}})
Beispiel #4
0
    def test_2(self):
        """
        interpolate_dict(a, b) merges non-shared properties
        """

        i = interpolate.dict({"foo": 2         },
                             {"foo": 4, "bar":4})
        self.assertEqual(i(.5), {"foo": 3, "bar": 4})
        
        i = interpolate.dict({"foo": 2, "bar":4},
                             {"foo": 4         })
        self.assertEqual(i(.5), {"foo": 3, "bar": 4})
Beispiel #5
0
    def test_1(self):
        """
        interpolate_dict(a, b) interpolates defined elements in a and b
        """

        i = interpolate.dict({"value": 2}, {"value": 4})
        self.assertEqual(i(.5), {"value": 3})
Beispiel #6
0
    def test_4(self):
        """
        interpolate_dict(a, b) interpolates color properties as rgb
        """

        i = interpolate.dict({"bg": "red"}, {"bg": "green"})
        self.assertEqual(i(.5), {"bg": "#804000"})
Beispiel #7
0
    def test_1(self):
        """
        interpolate_dict(a, b) interpolates defined elements in a and b
        """

        i = interpolate.dict({"value": 2}, {"value": 4})
        self.assertEqual(i(0.5), {"value": 3})
Beispiel #8
0
    def test_4(self):
        """
        interpolate_dict(a, b) interpolates color properties as rgb
        """

        i = interpolate.dict({"bg": "red"}, {"bg": "green"})
        self.assertEqual(i(0.5), {"bg": "#804000"})