|
5 | 5 | from datetime import datetime, timedelta |
6 | 6 | from decimal import Decimal |
7 | 7 | from fractions import Fraction |
8 | | -from typing import TypedDict |
| 8 | +from typing import TypedDict, Union |
9 | 9 | from typing_extensions import assert_type |
10 | 10 | from unittest.mock import AsyncMock, MagicMock, Mock, patch |
11 | 11 |
|
@@ -181,7 +181,7 @@ def method() -> int: |
181 | 181 |
|
182 | 182 |
|
183 | 183 | with patch("sys.exit") as default_new_enter: |
184 | | - assert_type(default_new_enter, MagicMock | AsyncMock) |
| 184 | + assert_type(default_new_enter, Union[MagicMock, AsyncMock]) |
185 | 185 |
|
186 | 186 | with patch("sys.exit", new=42) as explicit_new_enter: |
187 | 187 | assert_type(explicit_new_enter, int) |
@@ -219,7 +219,7 @@ def obj_f_explicit_new_callable(i: int, new_callable_ret: int) -> str: |
219 | 219 |
|
220 | 220 |
|
221 | 221 | with patch.object(Decimal, "exp") as obj_default_new_enter: |
222 | | - assert_type(obj_default_new_enter, MagicMock | AsyncMock) |
| 222 | + assert_type(obj_default_new_enter, Union[MagicMock, AsyncMock]) |
223 | 223 |
|
224 | 224 | with patch.object(Decimal, "exp", new=42) as obj_explicit_new_enter: |
225 | 225 | assert_type(obj_explicit_new_enter, int) |
|
0 commit comments