Skip to content

Commit b4f5073

Browse files
committed
PYTHON-4575 Remove hostname length check
1 parent 90e3a0d commit b4f5073

File tree

3 files changed

+0
-26
lines changed

3 files changed

+0
-26
lines changed

pymongo/srv_resolver.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ def __init__(
8484
except Exception:
8585
raise ConfigurationError(_INVALID_HOST_MSG % (fqdn,)) from None
8686
self.__slen = len(self.__plist)
87-
if self.__slen < 2:
88-
raise ConfigurationError(_INVALID_HOST_MSG % (fqdn,))
8987

9088
def get_options(self) -> Optional[str]:
9189
from dns import resolver

test/asynchronous/test_dns.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -185,18 +185,6 @@ def create_tests(cls):
185185

186186
class TestParsingErrors(AsyncPyMongoTestCase):
187187
async def test_invalid_host(self):
188-
self.assertRaisesRegex(
189-
ConfigurationError,
190-
"Invalid URI host: mongodb is not",
191-
self.simple_client,
192-
"mongodb+srv://mongodb",
193-
)
194-
self.assertRaisesRegex(
195-
ConfigurationError,
196-
"Invalid URI host: mongodb.com is not",
197-
self.simple_client,
198-
"mongodb+srv://mongodb.com",
199-
)
200188
self.assertRaisesRegex(
201189
ConfigurationError,
202190
"Invalid URI host: an IP address is not",

test/test_dns.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -183,18 +183,6 @@ def create_tests(cls):
183183

184184
class TestParsingErrors(PyMongoTestCase):
185185
def test_invalid_host(self):
186-
self.assertRaisesRegex(
187-
ConfigurationError,
188-
"Invalid URI host: mongodb is not",
189-
self.simple_client,
190-
"mongodb+srv://mongodb",
191-
)
192-
self.assertRaisesRegex(
193-
ConfigurationError,
194-
"Invalid URI host: mongodb.com is not",
195-
self.simple_client,
196-
"mongodb+srv://mongodb.com",
197-
)
198186
self.assertRaisesRegex(
199187
ConfigurationError,
200188
"Invalid URI host: an IP address is not",

0 commit comments

Comments
 (0)