Skip to content

Commit af36c85

Browse files
committed
feat: add __doc__ attribute to _MISSING_TYPE and test for None value
1 parent 8634761 commit af36c85

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/fieldz/_types.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@
3131

3232
class _MISSING_TYPE(enum.Enum):
3333
MISSING = "MISSING"
34+
__doc__ = None
3435

3536
def __repr__(self) -> str:
36-
return self.value
37+
return str(self.value)
3738

3839

3940
@dataclasses.dataclass(**DC_KWARGS)

tests/test_fieldz.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,9 @@ class Model(TypedDict):
256256
Field(name="d", type=bool),
257257
Field(name="e", type=list[int]),
258258
)
259+
260+
261+
def test_missing_has_no_doc() -> None:
262+
"""MISSING.__doc__ should be None, not inherited enum doc. gh-41."""
263+
assert Field.MISSING.__doc__ is None
264+
assert getattr(Field.MISSING, "__doc__", None) is None

0 commit comments

Comments
 (0)