File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -96,8 +96,6 @@ def __init__(
96
96
except Exception :
97
97
raise ConfigurationError (_INVALID_HOST_MSG % (fqdn ,)) from None
98
98
self .__slen = len (self .__plist )
99
- if self .__slen < 2 :
100
- raise ConfigurationError (_INVALID_HOST_MSG % (fqdn ,))
101
99
102
100
async def get_options (self ) -> Optional [str ]:
103
101
from dns import resolver
Original file line number Diff line number Diff line change @@ -96,8 +96,6 @@ def __init__(
96
96
except Exception :
97
97
raise ConfigurationError (_INVALID_HOST_MSG % (fqdn ,)) from None
98
98
self .__slen = len (self .__plist )
99
- if self .__slen < 2 :
100
- raise ConfigurationError (_INVALID_HOST_MSG % (fqdn ,))
101
99
102
100
def get_options (self ) -> Optional [str ]:
103
101
from dns import resolver
Original file line number Diff line number Diff line change 24
24
sys .path [0 :0 ] = ["" ]
25
25
26
26
from test import unittest
27
+ from unittest .mock import patch
27
28
28
29
from bson .binary import JAVA_LEGACY
29
30
from pymongo import ReadPreference
@@ -553,6 +554,11 @@ def test_port_with_whitespace(self):
553
554
with self .assertRaisesRegex (ValueError , r"Port contains whitespace character: '\\n'" ):
554
555
parse_uri ("mongodb://localhost:27\n 017" )
555
556
557
+ def test_allow_srv_hosts_with_fewer_than_three_dot_separated_parts (self ):
558
+ with patch ("dns.resolver.resolve" ):
559
+ parse_uri ("mongodb+srv://localhost/" )
560
+ parse_uri ("mongodb+srv://mongo.local/" )
561
+
556
562
557
563
if __name__ == "__main__" :
558
564
unittest .main ()
You can’t perform that action at this time.
0 commit comments