Example #1
0
 def __init__(self, cdict, sdict):
     self.cdict = cdict
     self.sdict = sdict
     self.keys_to_fix = []
     self.must_be_deleted = (self.sdict is not None and self.cdict is None)
     self.must_be_created = (self.cdict is not None and self.sdict is None)
     if not self.must_be_deleted and not self.must_be_created:
         self.keys_to_fix = diff_keys(cdict, sdict)
Example #2
0
 def test_difference(self):
     self.assertEqual(
         statedict.diff_keys(
             {'foo': "bar", 'baz': 1},
             {'foo': "bar", 'baz': 2},
         ),
         ['baz'],
     )
Example #3
0
 def test_identical(self):
     self.assertEqual(
         statedict.diff_keys(
             {'foo': "bar"},
             {'foo': "bar"},
         ),
         [],
     )
Example #4
0
 def __init__(self, cdict, sdict):
     self.cdict = cdict
     self.sdict = sdict
     self.keys_to_fix = []
     self.must_be_deleted = self.sdict is not None and self.cdict is None
     self.must_be_created = self.cdict is not None and self.sdict is None
     if not self.must_be_deleted and not self.must_be_created:
         self.keys_to_fix = diff_keys(cdict, sdict)
Example #5
0
 def test_different_keys(self):
     with self.assertRaises(ValueError):
         statedict.diff_keys(
             {'foo': "bar"},
             {'bar': "foo"},
         )