]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Add a couple of "# type: ignore" in datetime tests
authorDenis Laxalde <denis.laxalde@dalibo.com>
Thu, 28 Oct 2021 08:55:21 +0000 (10:55 +0200)
committerDenis Laxalde <denis.laxalde@dalibo.com>
Tue, 2 Nov 2021 08:52:49 +0000 (09:52 +0100)
Mypy cannot check map() calls on split-strings.

tests/types/test_datetime.py

index a5484db7242e3b42fc82703883ba8265aaa14586..7d51cfa028e6903dc1b6b96ff09e51e0b62eaf24 100644 (file)
@@ -672,7 +672,10 @@ def as_time(s):
     else:
         off = None
 
-    rv = dt.time(*map(int, s.split(","))) if "," in s else getattr(dt.time, s)
+    if "," in s:
+        rv = dt.time(*map(int, s.split(",")))  # type: ignore[arg-type]
+    else:
+        rv = getattr(dt.time, s)
     if off:
         rv = rv.replace(tzinfo=as_tzinfo(off))
 
@@ -692,7 +695,7 @@ def as_dt(s):
 
 def as_naive_dt(s):
     if "," in s:
-        rv = dt.datetime(*map(int, s.split(",")))
+        rv = dt.datetime(*map(int, s.split(",")))  # type: ignore[arg-type]
     else:
         rv = getattr(dt.datetime, s)