Skip to content

Commit

Permalink
Update openpyxl tests
Browse files Browse the repository at this point in the history
  • Loading branch information
srittau committed Oct 19, 2024
1 parent 42fba90 commit 69761f0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
14 changes: 7 additions & 7 deletions stubs/openpyxl/@tests/test_cases/check_base_descriptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class WithDescriptorsStrict(Strict):
# Test getters
assert_type(with_descriptors.descriptor, str)

assert_type(with_descriptors.typed_not_none, str) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.typed_not_none, str)
assert_type(with_descriptors.typed_none, Union[str, None])

assert_type(with_descriptors.set_tuple, Union[Literal["a", 1], float]) # type: ignore[assert-type] # False-positive in mypy
Expand All @@ -172,9 +172,9 @@ class WithDescriptorsStrict(Strict):
assert_type(with_descriptors.length_tuple, Tuple[str, str])
assert_type(with_descriptors.length_list, List[str])

assert_type(with_descriptors.match_pattern_str, str) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.match_pattern_str, str)
assert_type(with_descriptors.match_pattern_str_none, Union[str, None])
assert_type(with_descriptors.match_pattern_bytes, ReadableBuffer) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.match_pattern_bytes, ReadableBuffer)
assert_type(with_descriptors.match_pattern_bytes_none, Union[ReadableBuffer, None])

assert_type(with_descriptors.convertible_not_none, int) # type: ignore[assert-type] # False-positive in mypy
Expand Down Expand Up @@ -208,7 +208,7 @@ class WithDescriptorsStrict(Strict):


with_descriptors.typed_not_none = ""
with_descriptors.typed_not_none = None # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.typed_not_none = None # type: ignore
with_descriptors.typed_not_none = 0 # type: ignore

with_descriptors.typed_none = ""
Expand Down Expand Up @@ -267,7 +267,7 @@ class WithDescriptorsStrict(Strict):


with_descriptors.match_pattern_str = ""
with_descriptors.match_pattern_str = None # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.match_pattern_str = None # type: ignore
with_descriptors.match_pattern_str = b"" # type: ignore
with_descriptors.match_pattern_str = 0 # type: ignore

Expand All @@ -277,7 +277,7 @@ class WithDescriptorsStrict(Strict):
with_descriptors.match_pattern_str_none = 0 # type: ignore

with_descriptors.match_pattern_bytes = b""
with_descriptors.match_pattern_bytes = None # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.match_pattern_bytes = None # type: ignore
with_descriptors.match_pattern_bytes = "" # type: ignore
with_descriptors.match_pattern_bytes = 0 # type: ignore

Expand Down Expand Up @@ -340,7 +340,7 @@ class WithDescriptorsStrict(Strict):

with_descriptors.datetime_not_none = datetime(0, 0, 0)
with_descriptors.datetime_not_none = ""
with_descriptors.datetime_not_none = None # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.datetime_not_none = None # type: ignore
with_descriptors.datetime_not_none = 0 # type: ignore
with_descriptors.datetime_not_none = date(0, 0, 0) # type: ignore
with_descriptors.datetime_not_none = time() # type: ignore
Expand Down
30 changes: 15 additions & 15 deletions stubs/openpyxl/@tests/test_cases/check_nested_descriptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,23 +154,23 @@ class WithDescriptorsStrict(Strict):
assert_type(with_descriptors.noneset_tuple, Union[Literal["a", 1], float, None]) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.noneset_list, Union[str, float, None]) # type: ignore[assert-type] # False-positive in mypy # int and float are merged in generic unions

assert_type(with_descriptors.convertible_not_none, int) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.convertible_not_none, int)
assert_type(with_descriptors.convertible_none, Union[int, None])

assert_type(with_descriptors.text_str_not_none, str) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.text_str_not_none, str)
assert_type(with_descriptors.text_str_none, Union[str, None])
assert_type(with_descriptors.text_int_not_none, int) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.text_int_not_none, int)
assert_type(with_descriptors.text_int_none, Union[int, None])

assert_type(with_descriptors.minmax_float, float) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.minmax_float, float)
assert_type(with_descriptors.minmax_float_none, Union[float, None])
assert_type(with_descriptors.minmax_int, int) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.minmax_int, int)
assert_type(with_descriptors.minmax_int_none, Union[int, None])

assert_type(with_descriptors.bool_not_none, bool) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.bool_none, Union[bool, None])

assert_type(with_descriptors.emptytag_not_none, bool) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.emptytag_not_none, bool)
assert_type(with_descriptors.emptytag_none, Union[bool, None])

assert_type(with_descriptors.string_not_none, str) # type: ignore[assert-type] # False-positive in mypy
Expand Down Expand Up @@ -301,16 +301,16 @@ class WithDescriptorsStrict(Strict):

with_descriptors.text_int_not_none = 0
with_descriptors.text_int_not_none = "0"
with_descriptors.text_int_not_none = None # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.text_int_not_none = object() # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.text_int_not_none = None # type: ignore
with_descriptors.text_int_not_none = object() # type: ignore
# If expected type (_T) is not str, it's impossible to use an Element as the value
with_descriptors.text_int_not_none = cast( # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.text_int_not_none = cast( # type: ignore
_HasTagAndGet[int], _
)
with_descriptors.text_int_not_none = cast( # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.text_int_not_none = cast( # type: ignore
_HasTagAndGet[None], _
)
with_descriptors.text_int_not_none = cast( # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.text_int_not_none = cast( # type: ignore
_HasTagAndGet[str], _
)

Expand All @@ -333,10 +333,10 @@ class WithDescriptorsStrict(Strict):
with_descriptors.minmax_float = 0
with_descriptors.minmax_float = "0"
with_descriptors.minmax_float = 0.0
with_descriptors.minmax_float = None # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.minmax_float = None # type: ignore
with_descriptors.minmax_float = object() # type: ignore
with_descriptors.minmax_float = cast(_HasTagAndGet[float], _)
with_descriptors.minmax_float = cast( # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.minmax_float = cast( # type: ignore
_HasTagAndGet[None], _
)
with_descriptors.minmax_float = cast(_HasTagAndGet[object], _) # type: ignore
Expand All @@ -353,10 +353,10 @@ class WithDescriptorsStrict(Strict):
with_descriptors.minmax_int = 0
with_descriptors.minmax_int = "0"
with_descriptors.minmax_int = 0.0
with_descriptors.minmax_int = None # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.minmax_int = None # type: ignore
with_descriptors.minmax_int = object() # type: ignore
with_descriptors.minmax_int = cast(_HasTagAndGet[int], _)
with_descriptors.minmax_int = cast(_HasTagAndGet[None], _) # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.minmax_int = cast(_HasTagAndGet[None], _) # type: ignore
with_descriptors.minmax_int = cast(_HasTagAndGet[object], _) # type: ignore

with_descriptors.minmax_int_none = 0
Expand Down

0 comments on commit 69761f0

Please sign in to comment.