Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-3378

Improve Handling out of range datetimes docs section

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Unknown Unknown
    • 4.3
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible

      The Handling out of range datetimes section could use some improvements:
      https://pymongo.readthedocs.io/en/latest/examples/datetimes.html?highlight=datetimems#handling-out-of-range-datetimes

      First, the code example does not render and shows up blank. Checking the doctest:

       [2022/07/28 17:32:10.106] Document: faq
       [2022/07/28 17:32:10.106] -------------
       [2022/07/28 17:32:10.106] **********************************************************************
       [2022/07/28 17:32:10.106] File "faq.rst", line 263, in key-order
       [2022/07/28 17:32:10.106] Failed example:
       [2022/07/28 17:32:10.106]     opts
       [2022/07/28 17:32:10.106] Expected:
       [2022/07/28 17:32:10.106]     CodecOptions(document_class=...SON..., tz_aware=False, uuid_representation=UuidRepresentation.UNSPECIFIED, unicode_decode_error_handler='strict', tzinfo=None, type_registry=TypeRegistry(type_codecs=[], fallback_encoder=None))
       [2022/07/28 17:32:10.106] Got:
       [2022/07/28 17:32:10.106]     CodecOptions(document_class=<class 'bson.son.SON'>, tz_aware=False, uuid_representation=UuidRepresentation.UNSPECIFIED, unicode_decode_error_handler='strict', tzinfo=None, type_registry=TypeRegistry(type_codecs=[], fallback_encoder=None), datetime_conversion=1)
       [2022/07/28 17:32:10.108] **********************************************************************
       [2022/07/28 17:32:10.108] 1 items had failures:
       [2022/07/28 17:32:10.108]    1 of   5 in key-order
       [2022/07/28 17:32:10.108] 5 tests in 1 items.
       [2022/07/28 17:32:10.108] 4 passed and 1 failed.
       [2022/07/28 17:32:10.108] ***Test Failed*** 1 failures.
      

      And later:

       [2022/07/28 17:32:14.379] WARNING: no code/output in doctest block at examples/datetimes.rst:143
      

      https://evergreen.mongodb.com/task/mongo_python_driver_tests_doctests__platform~ubuntu_18.04_python_version~3.8_doctests_14002a5a0d294cae8c2c5349e1a92364381dfd4d_22_07_27_23_53_52

      Second, we should add more examples to show the decoding behavior of each DatetimeConversionOpts.

            Assignee:
            ben.warner@mongodb.com Ben Warner (Inactive)
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: