Convert an object to a dictionary for comparison.
(obj)
| 45 | |
| 46 | |
| 47 | def to_dict(obj): |
| 48 | """Convert an object to a dictionary for comparison.""" |
| 49 | if hasattr(obj, "as_dict"): |
| 50 | return obj.as_dict() |
| 51 | elif hasattr(obj, "__dataclass_fields__"): |
| 52 | from dataclasses import asdict |
| 53 | |
| 54 | return asdict(obj) |
| 55 | else: |
| 56 | return obj |
| 57 | |
| 58 | |
| 59 | def cross_language_test(test_func): |
no outgoing calls
no test coverage detected