Skip to content

Commit 0c56d56

Browse files
bcwarnerBen Warner
andauthored
PYTHON-3371 Remove DatetimeConversionOpts.__repr__ (#1023)
* Removed __repr__ and adjusted repr string * Changed to %s Co-authored-by: Ben Warner <[email protected]>
1 parent 14002a5 commit 0c56d56

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

bson/codec_options.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,6 @@ class DatetimeConversionOpts(enum.IntEnum):
205205
DATETIME_MS = 3
206206
DATETIME_AUTO = 4
207207

208-
def __repr__(self):
209-
return f"{self.value}"
210-
211208

212209
class _BaseCodecOptions(NamedTuple):
213210
document_class: Type[Mapping[str, Any]]
@@ -370,7 +367,7 @@ def _arguments_repr(self) -> str:
370367
return (
371368
"document_class=%s, tz_aware=%r, uuid_representation=%s, "
372369
"unicode_decode_error_handler=%r, tzinfo=%r, "
373-
"type_registry=%r, datetime_conversion=%r"
370+
"type_registry=%r, datetime_conversion=%s"
374371
% (
375372
document_class_repr,
376373
self.tz_aware,

test/test_bson.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,8 @@ def test_codec_options_repr(self):
980980
"uuid_representation=UuidRepresentation.UNSPECIFIED, "
981981
"unicode_decode_error_handler='strict', "
982982
"tzinfo=None, type_registry=TypeRegistry(type_codecs=[], "
983-
"fallback_encoder=None), datetime_conversion=1)"
983+
"fallback_encoder=None), "
984+
"datetime_conversion=DatetimeConversionOpts.DATETIME)"
984985
)
985986
self.assertEqual(r, repr(CodecOptions()))
986987

0 commit comments

Comments
 (0)