Skip to content

Commit 96f966c

Browse files
committed
Fix typechecking of tests
1 parent 3e06052 commit 96f966c

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

tests/test_config_extended.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ def test_save_and_reload(self, tmp_path) -> None:
271271
cfg.save_config(config_path)
272272
loaded = Config.load_config(config_path)
273273
assert isinstance(loaded, DotDict)
274+
assert cfg.current_config is not None
274275
assert loaded["core"]["db_debug"] == cfg.current_config["core"]["db_debug"]
275276

276277

tests/validators/test_validators_extended.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def test_np_bool_accepted(self) -> None:
153153
def test_non_bool_raises(self) -> None:
154154
b = Bool()
155155
with pytest.raises(TypeError, match="not Boolean"):
156-
b.validate(1)
156+
b.validate(1) # pyright: ignore[reportArgumentType]
157157

158158
def test_repr(self) -> None:
159159
assert repr(Bool()) == "<Boolean>"
@@ -201,7 +201,7 @@ def test_max_less_than_min(self) -> None:
201201
def test_non_string_raises(self) -> None:
202202
s = Strings()
203203
with pytest.raises(TypeError, match="not a string"):
204-
s.validate(42)
204+
s.validate(42) # pyright: ignore[reportArgumentType]
205205

206206
def test_repr_with_constraints(self) -> None:
207207
s = Strings(min_length=2, max_length=10)
@@ -231,12 +231,12 @@ class TestEnumExtended:
231231
def test_unhashable_raises_type_error(self) -> None:
232232
e = Enum("a", "b")
233233
with pytest.raises(TypeError):
234-
e.validate([1, 2]) # list is unhashable
234+
e.validate([1, 2]) # pyright: ignore[reportArgumentType] # list is unhashable
235235

236236
def test_unhashable_error_includes_context(self) -> None:
237237
e = Enum("a", "b")
238238
with pytest.raises(TypeError, match="test_ctx"):
239-
e.validate([1, 2], context="test_ctx")
239+
e.validate([1, 2], context="test_ctx") # pyright: ignore[reportArgumentType] # list is unhashable
240240

241241
def test_values_returns_copy(self) -> None:
242242
e = Enum("x", "y")
@@ -271,7 +271,7 @@ def test_other_string_rejected(self) -> None:
271271

272272
def test_non_string_rejected(self) -> None:
273273
with pytest.raises((TypeError, ValueError)):
274-
OnOff().validate(1)
274+
OnOff().validate(1) # pyright: ignore[reportArgumentType]
275275

276276
def test_valid_values(self) -> None:
277277
assert set(OnOff().valid_values) == {"on", "off"}
@@ -574,7 +574,7 @@ def test_with_element_validator(self) -> None:
574574
lst = Lists(elt_validator=Ints())
575575
lst.validate([1, 2, 3])
576576
with pytest.raises(TypeError):
577-
lst.validate(["a", "b"])
577+
lst.validate(["a", "b"]) # pyright: ignore[reportArgumentType]
578578

579579
def test_repr_format(self) -> None:
580580
lst = Lists(elt_validator=Ints())
@@ -660,7 +660,7 @@ def test_callable_passes(self) -> None:
660660
def test_non_callable_raises(self) -> None:
661661
c = CallableValidator()
662662
with pytest.raises(TypeError, match="not a callable"):
663-
c.validate(42)
663+
c.validate(42) # pyright: ignore[reportArgumentType]
664664

665665
def test_repr(self) -> None:
666666
assert repr(CallableValidator()) == "<Callable>"

0 commit comments

Comments
 (0)