assert_schemas_equal

emmet.core.testing_utils.assert_schemas_equal(test_schema, valid_schema, float_comparator=_float_comparator)

Recursively test all items in valid_schema are present and equal in test_schema.

While test_schema can be a pydantic schema or dictionary, the valid schema must be a (nested) dictionary. This function automatically handles accessing the attributes of classes in the test_schema.

Return type:

None

Parameters:
  • test_schema (Any)

  • valid_schema (Any)

  • float_comparator (Callable)

Args:

test_schema: A pydantic schema or dictionary of the schema. valid_schema: A (nested) dictionary specifying the key and values that must be

present in test_schema.

float_comparator (Callable)A method to compare floats. Defaults to math.isclose.

Should return a bool if two floats are approximately equal, and False otherwise.