Skip to content

Commit 9d57b5a

Browse files
authored
fix coverage after dropping 3.7 (#91)
1 parent 2708fbc commit 9d57b5a

File tree

3 files changed

+4
-21
lines changed

3 files changed

+4
-21
lines changed

dirty_equals/_base.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
from abc import ABCMeta
2-
from typing import TYPE_CHECKING, Any, Dict, Generic, Iterable, Optional, Tuple, TypeVar
3-
4-
try:
5-
from typing import Protocol
6-
except ImportError:
7-
# Python 3.7 doesn't have Protocol
8-
Protocol = object # type: ignore[assignment]
2+
from typing import TYPE_CHECKING, Any, Dict, Generic, Iterable, Optional, Protocol, Tuple, TypeVar
93

104
from ._utils import Omit
115

dirty_equals/_other.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,13 @@
66
from enum import Enum
77
from functools import lru_cache
88
from ipaddress import IPv4Address, IPv4Network, IPv6Address, IPv6Network, ip_network
9-
from typing import TYPE_CHECKING, Any, Callable, TypeVar, Union, overload
9+
from typing import TYPE_CHECKING, Any, Callable, Literal, TypeVar, Union, overload
1010
from uuid import UUID
1111

1212
from ._base import DirtyEquals
1313
from ._dict import IsDict
1414
from ._utils import Omit, plain_repr
1515

16-
try:
17-
from typing import Literal
18-
except ImportError:
19-
from typing_extensions import Literal # type: ignore[assignment]
20-
21-
2216
if TYPE_CHECKING:
2317
from pydantic import TypeAdapter
2418

@@ -233,7 +227,7 @@ def __init__(
233227
)
234228

235229
self.ValidationError = ValidationError
236-
except ImportError as e:
230+
except ImportError as e: # pragma: no cover
237231
raise ImportError('Pydantic V2 is not installed, run `pip install dirty-equals[pydantic]`') from e
238232
url_type_mappings = {
239233
AnyUrl: any_url,

dirty_equals/_strings.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
import re
2-
from typing import Any, Optional, Pattern, Tuple, Type, TypeVar, Union
2+
from typing import Any, Literal, Optional, Pattern, Tuple, Type, TypeVar, Union
33

44
from ._base import DirtyEquals
55
from ._utils import Omit, plain_repr
66

7-
try:
8-
from typing import Literal
9-
except ImportError:
10-
from typing_extensions import Literal # type: ignore[assignment]
11-
127
T = TypeVar('T', str, bytes)
138

149
__all__ = 'IsStr', 'IsBytes', 'IsAnyStr'

0 commit comments

Comments
 (0)