Skip to content

PYTHON-5421 continued - update changelog, update docstring, and add testing #2420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ PyMongo 4.14 brings a number of changes including:

- Introduces a minor breaking change. When encoding :class:`bson.binary.BinaryVector`, a ``ValueError`` will be raised
if the 'padding' metadata field is < 0 or > 7, or non-zero for any type other than PACKED_BIT.
- Changed :meth:`~pymongo.uri_parser.parse_uri`'s 'options' to be type ``dict`` instead of ``_CaseInsensitiveDictionary``.

Changes in Version 4.13.2 (2025/06/17)
--------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions pymongo/asynchronous/uri_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ async def parse_uri(
wait for a response from the DNS server.
:param srv_service_name: A custom SRV service name

.. versionchanged:: 4.14
'options' is now type ``dict`` as opposed to a ``_CaseInsensitiveDictionary``.

.. versionchanged:: 4.6
The delimiting slash (``/``) between hosts and connection options is now optional.
For example, "mongodb://example.com?tls=true" is now a valid URI.
Expand Down
3 changes: 3 additions & 0 deletions pymongo/synchronous/uri_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ def parse_uri(
wait for a response from the DNS server.
:param srv_service_name: A custom SRV service name

.. versionchanged:: 4.14
'options' is now type ``dict`` as opposed to a ``_CaseInsensitiveDictionary``.

.. versionchanged:: 4.6
The delimiting slash (``/``) between hosts and connection options is now optional.
For example, "mongodb://example.com?tls=true" is now a valid URI.
Expand Down
4 changes: 4 additions & 0 deletions test/test_uri_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,10 @@ def test_port_with_whitespace(self):
with self.assertRaisesRegex(ValueError, r"Port contains whitespace character: '\\n'"):
parse_uri("mongodb://localhost:27\n017")

def test_parse_uri_options_type(self):
opts = parse_uri("mongodb://localhost:27017")["options"]
self.assertIsInstance(opts, dict)


if __name__ == "__main__":
unittest.main()
Loading