Skip to content

Commit

Permalink
Remove post-3.8 typing features.
Browse files Browse the repository at this point in the history
  • Loading branch information
wRAR committed Jul 5, 2023
1 parent 21c5188 commit 398b197
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions tests/test_selector_csstranslator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Selector tests for cssselect backend
"""
import unittest
from typing import Any, Callable, List, Type, Protocol
from typing import Any, Callable, List, Type, Protocol, Tuple, Union

import cssselect
import pytest
Expand Down Expand Up @@ -66,8 +66,9 @@ def assertEqual(self, first: Any, second: Any, msg: Any = ...) -> None:

def assertRaises(
self,
expected_exception: type[BaseException]
| tuple[type[BaseException], ...],
expected_exception: Union[
Type[BaseException], Tuple[Type[BaseException], ...]
],
callable: Callable[..., object],
*args: Any,
**kwargs: Any,
Expand Down
6 changes: 4 additions & 2 deletions tests/typing/selector.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Basic usage of the Selector, strongly typed to test the typing of parsel's API.
import re
from typing import List

from parsel import Selector


Expand All @@ -8,9 +10,9 @@ def correct() -> None:
text="<html><body><ul><li>1</li><li>2</li><li>3</li></ul></body></html>"
)

li_values: list[str] = selector.css("li").getall()
li_values: List[str] = selector.css("li").getall()
selector.re_first(re.compile(r"[32]"), "").strip()
xpath_values: list[str] = selector.xpath(
xpath_values: List[str] = selector.xpath(
"//somens:a/text()", namespaces={"somens": "http://scrapy.org"}
).extract()

Expand Down

0 comments on commit 398b197

Please sign in to comment.