Exemplo n.º 1
0
    def test_copy2(self):
        a = Data(b="c")
        aa = copy(a)
        self.assertEqual(aa, a, "expecting to be the same")
        self.assertEqual(a, aa, "expecting to be the same")

        a.b = "d"
        self.assertNotEqual(a, aa, "expecting to be different now")
        self.assertNotEqual(aa, a, "expecting to be different now")
Exemplo n.º 2
0
    def test_update2_with_lists(self):
        org = Data()
        org.a = [1, 2, {'a': 'superman'}]
        someother = Data()
        someother.b = [{'b': 123}]
        org |= someother

        correct = {'a': [1, 2, {'a': 'superman'}], 'b': [{'b': 123}]}

        org |= someother
        self.assertEqual(org, correct)
        self.assertIsInstance(org.b[0], Mapping)