Skip to content

Commit 3535a99

Browse files
committed
Update wrapper test to look for __repr__ special function
1 parent 715ff51 commit 3535a99

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

python/tests/test_wrapper_coverage.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@
2828
from enum import EnumMeta as EnumType
2929

3030

31-
def missing_exports(internal_obj, wrapped_obj) -> None:
31+
def missing_exports(internal_obj, wrapped_obj) -> None: # noqa: C901
3232
"""
3333
Identify if any of the rust exposted structs or functions do not have wrappers.
3434
3535
Special handling for:
3636
- Raw* classes: Internal implementation details that shouldn't be exposed
3737
- _global_ctx: Internal implementation detail
38-
- __self__, __class__: Python special attributes
38+
- __self__, __class__, __repr__: Python special attributes
3939
"""
4040
# Special case enums - EnumType overrides a some of the internal functions,
4141
# so check all of the values exist and move on
@@ -45,6 +45,9 @@ def missing_exports(internal_obj, wrapped_obj) -> None:
4545
assert value in dir(wrapped_obj)
4646
return
4747

48+
if "__repr__" in internal_obj.__dict__ and "__repr__" not in wrapped_obj.__dict__:
49+
pytest.fail(f"Missing __repr__: {internal_obj.__name__}")
50+
4851
for internal_attr_name in dir(internal_obj):
4952
wrapped_attr_name = internal_attr_name.removeprefix("Raw")
5053
assert wrapped_attr_name in dir(wrapped_obj)

0 commit comments

Comments
 (0)