MCPcopy
hub / github.com/RasaHQ/rasa / test_equal_dicts

Function test_equal_dicts

tests/utils/tensorflow/test_models.py:43–57  ·  view source on GitHub ↗
(
        dict1: Dict[Text, Union[np.ndarray, Dict[Text, np.ndarray]]],
        dict2: Dict[Text, Union[np.ndarray, Dict[Text, np.ndarray]]],
    )

Source from the content-addressed store, hash-verified

41 )
42
43 def test_equal_dicts(
44 dict1: Dict[Text, Union[np.ndarray, Dict[Text, np.ndarray]]],
45 dict2: Dict[Text, Union[np.ndarray, Dict[Text, np.ndarray]]],
46 ) -> None:
47 assert dict2.keys() == dict1.keys()
48 for key in dict1:
49 val_1 = dict1[key]
50 val_2 = dict2[key]
51 assert type(val_1) == type(val_2)
52
53 if isinstance(val_2, np.ndarray):
54 assert np.array_equal(val_1, val_2)
55
56 elif isinstance(val_2, dict):
57 test_equal_dicts(val_1, val_2)
58
59 test_equal_dicts(predicted_output, expected_output)
60

Callers 1

Calls 1

keysMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…