summaryrefslogtreecommitdiff
path: root/sphinx/testing/comparer.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/testing/comparer.py')
-rw-r--r--sphinx/testing/comparer.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/sphinx/testing/comparer.py b/sphinx/testing/comparer.py
index 72494ae5a..8b2ec8892 100644
--- a/sphinx/testing/comparer.py
+++ b/sphinx/testing/comparer.py
@@ -3,7 +3,7 @@ from __future__ import annotations
import difflib
import pathlib
-from typing import Any, Union
+from typing import Any
class PathComparer:
@@ -26,7 +26,7 @@ class PathComparer:
>>> 'C:\\to\\index' == PathComparer('D:/to/index')
False
"""
- def __init__(self, path: Union[str, pathlib.Path]):
+ def __init__(self, path: str | pathlib.Path):
"""
:param str path: path string, it will be cast as pathlib.Path.
"""
@@ -38,10 +38,10 @@ class PathComparer:
def __repr__(self) -> str:
return "<{0.__class__.__name__}: '{0}'>".format(self)
- def __eq__(self, other: Union[str, pathlib.Path]) -> bool: # type: ignore
+ def __eq__(self, other: str | pathlib.Path) -> bool: # type: ignore
return not bool(self.ldiff(other))
- def diff(self, other: Union[str, pathlib.Path]) -> list[str]:
+ def diff(self, other: str | pathlib.Path) -> list[str]:
"""compare self and other.
When different is not exist, return empty list.
@@ -60,13 +60,13 @@ class PathComparer:
"""
return self.ldiff(other)
- def ldiff(self, other: Union[str, pathlib.Path]) -> list[str]:
+ def ldiff(self, other: str | pathlib.Path) -> list[str]:
return self._diff(
self.path,
pathlib.Path(other),
)
- def rdiff(self, other: Union[str, pathlib.Path]) -> list[str]:
+ def rdiff(self, other: str | pathlib.Path) -> list[str]:
return self._diff(
pathlib.Path(other),
self.path,