'Helper to check if two dicts with floatst or integers are close.'

def assert_dictionary_close(self, dict1, dict2):

    self.assertEqual(sorted(dict1.keys()), sorted(dict2.keys()))
    for key in dict1:
        value = dict1[key]
        if isinstance(value, float):
            self.assertAlmostEqual(value, dict2[key])
        else:
            self.assertEqual(value, dict2[key])
