Skip to content

Commit 4ea22c7

Browse files
committed
verify that we get an error
This commit was sponsored by Blaise Pabon, and my other patrons. If you want to join them, you can support my work at https://glyph.im/patrons/.
1 parent 05d4f76 commit 4ea22c7

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

expected_mypy.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,5 @@ tryit.py:53: note: def timetz(self) -> Time[None]
4343
tryit.py:53: note: Got:
4444
tryit.py:53: note: def timetz(self) -> Time[timezone]
4545
tryit.py:53: note: tzinfo: expected "None", got "timezone"
46-
Found 9 errors in 1 file (checked 1 source file)
46+
tryit.py:56: error: Incompatible types in assignment (expression has type "NaiveTime", variable has type "DateTime[timezone]") [assignment]
47+
Found 10 errors in 1 file (checked 1 source file)

tryit.py

+2
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,5 @@
5252

5353
not_naive: NaiveDateTime = a.astimezone()
5454
is_aware: DateTime[timezone] = a.astimezone(None)
55+
56+
not_aware_method_time: DateTime[timezone] = a.time() # nope; actually naive

0 commit comments

Comments
 (0)