From 088f0663e37bac29d0f5fa4f1261f1e7a211e28a Mon Sep 17 00:00:00 2001 From: Cody Logan Date: Wed, 8 Nov 2023 09:16:57 -0800 Subject: Revise type annotations per PEP 604 --- tests/test_validations.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'tests/test_validations.py') diff --git a/tests/test_validations.py b/tests/test_validations.py index a1c57b5..a8fbf1b 100644 --- a/tests/test_validations.py +++ b/tests/test_validations.py @@ -15,9 +15,10 @@ # You should have received a copy of the GNU General Public License # along with Wikiget. If not, see . +from __future__ import annotations + from pathlib import Path from re import Match -from typing import Optional import pytest @@ -33,7 +34,7 @@ class TestSiteInput: "en.wikimpedia.org", ], ) - def invalid_input(self, request: pytest.FixtureRequest) -> Optional[Match]: + def invalid_input(self, request: pytest.FixtureRequest) -> Match | None: return valid_site(request.param) @pytest.fixture( @@ -44,7 +45,7 @@ class TestSiteInput: "meta.wikimedia.org", ], ) - def valid_input(self, request: pytest.FixtureRequest) -> Optional[Match]: + def valid_input(self, request: pytest.FixtureRequest) -> Match | None: return valid_site(request.param) def test_invalid_site_input(self, invalid_input: None) -> None: @@ -58,7 +59,7 @@ class TestSiteInput: class TestFileRegex: @pytest.fixture() - def file_match(self) -> Optional[Match]: + def file_match(self) -> Match | None: """ File regex should return a match object with match groups corresponding to the file prefix and name. @@ -87,7 +88,7 @@ class TestFileInput: "Fil:Example.jpg", ], ) - def invalid_input(self, request: pytest.FixtureRequest) -> Optional[Match]: + def invalid_input(self, request: pytest.FixtureRequest) -> Match | None: return valid_file(request.param) @pytest.fixture( @@ -100,7 +101,7 @@ class TestFileInput: "File:A (1).jpeg", ], ) - def valid_input(self, request: pytest.FixtureRequest) -> Optional[Match]: + def valid_input(self, request: pytest.FixtureRequest) -> Match | None: return valid_file(request.param) def test_invalid_file_input(self, invalid_input: None) -> None: -- cgit v1.2.3