def test_b(self): """Test the comparison of a simple dict of dict. The field is only present for one bucket. """ comparer = ConfigComparer() d = {'3201-DGW-1': {'SURFTYPE': 0.0}} e = {'3201-DGW-1': {}} diff = comparer.dict_compare(d, e) self.assertEqual({'3201-DGW-1': {'SURFTYPE': (0.0, _('not present'))}}, diff)
def test_c(self): """Test the comparison of a simple dict of dict. The bucket is only present in the new configuration. """ comparer = ConfigComparer() d = {'3201-DGW-1': {'SURFTYPE': 0.0}} e = {} diff = comparer.dict_compare(d, e) self.assertEqual({'3201-DGW-1': {'SURFTYPE': (0.0, _('not present'))}}, diff)
def test_a(self): """Test the comparison of a simple dict of dict. The fields are present for both buckets but with different values. """ comparer = ConfigComparer() d = {'3201-DGW-1': {'SURFTYPE': 0.0}} e = {'3201-DGW-1': {'SURFTYPE': 0.1}} diff = comparer.dict_compare(d, e) self.assertEqual({'3201-DGW-1': {'SURFTYPE': (0.0, 0.1)}}, diff)
def create_comparer(self, new_attrs, current_attrs): comparer = ConfigComparer() comparer.get_new_attrs = lambda c: new_attrs comparer.get_current_attrs = lambda c: current_attrs return comparer