Skip to content

Commit c77c15e

Browse files
authored
PYTHON-5421 continued - update changelog, update docstring, and add testing (#2420)
1 parent 11d3488 commit c77c15e

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

doc/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ PyMongo 4.14 brings a number of changes including:
1313

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

1718
Changes in Version 4.13.2 (2025/06/17)
1819
--------------------------------------

pymongo/asynchronous/uri_parser.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ async def parse_uri(
8080
wait for a response from the DNS server.
8181
:param srv_service_name: A custom SRV service name
8282
83+
.. versionchanged:: 4.14
84+
``options`` is now type ``dict`` as opposed to a ``_CaseInsensitiveDictionary``.
85+
8386
.. versionchanged:: 4.6
8487
The delimiting slash (``/``) between hosts and connection options is now optional.
8588
For example, "mongodb://example.com?tls=true" is now a valid URI.

pymongo/synchronous/uri_parser.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ def parse_uri(
8080
wait for a response from the DNS server.
8181
:param srv_service_name: A custom SRV service name
8282
83+
.. versionchanged:: 4.14
84+
``options`` is now type ``dict`` as opposed to a ``_CaseInsensitiveDictionary``.
85+
8386
.. versionchanged:: 4.6
8487
The delimiting slash (``/``) between hosts and connection options is now optional.
8588
For example, "mongodb://example.com?tls=true" is now a valid URI.

test/test_uri_parser.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,10 @@ def test_port_with_whitespace(self):
555555
with self.assertRaisesRegex(ValueError, r"Port contains whitespace character: '\\n'"):
556556
parse_uri("mongodb://localhost:27\n017")
557557

558+
def test_parse_uri_options_type(self):
559+
opts = parse_uri("mongodb://localhost:27017")["options"]
560+
self.assertIsInstance(opts, dict)
561+
558562

559563
if __name__ == "__main__":
560564
unittest.main()

0 commit comments

Comments
 (0)