Skip to content

Commit be7a67c

Browse files
committed
change standard repr to ClassName
1 parent f248baf commit be7a67c

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

25-class-metaprog/sentinel/sentinel.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
33
>>> class Missing(Sentinel): pass
44
>>> Missing
5-
<Missing>
5+
Missing
66
>>> class CustomRepr(Sentinel):
7-
... repr = '*** sentinel ***'
7+
... repr = '<CustomRepr>'
88
...
99
>>> CustomRepr
10-
*** sentinel ***
10+
<CustomRepr>
1111
1212
"""
1313

@@ -16,9 +16,8 @@ def __repr__(cls):
1616
try:
1717
return cls.repr
1818
except AttributeError:
19-
return f'<{cls.__name__}>'
19+
return cls.__name__
2020

2121
class Sentinel(metaclass=SentinelMeta):
2222
def __new__(cls):
2323
return cls
24-

25-class-metaprog/sentinel/sentinel_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class SentinelCustomRepr(Sentinel):
88

99

1010
def test_repr():
11-
assert repr(PlainSentinel) == '<PlainSentinel>'
11+
assert repr(PlainSentinel) == 'PlainSentinel'
1212

1313

1414
def test_pickle():

0 commit comments

Comments
 (0)