- def assert_subfield(self, idx, path, value):
- assert path
-
- field = self.result[idx]
- for p in path:
- assert isinstance(field, dict)
- assert p in field
- field = field[p]
-
- if isinstance(value, float):
- assert Almost(value) == float(field)
- elif value.startswith("^"):
- assert re.fullmatch(value, field)
- elif isinstance(field, dict):
- assert field, eval('{' + value + '}')
- else:
- assert str(field) == str(value)
-
-