Enable "warn_unreachable"
Also, remove the dead `isinstance()` check in `Location.relate_to()`
This commit is contained in:
parent
0a5f8f6c55
commit
784d5c8ca0
3 changed files with 3 additions and 9 deletions
|
|
@ -486,6 +486,9 @@ warn_redundant_casts = true
|
||||||
# Report functions returning `Any` despite a non-`Any` return type
|
# Report functions returning `Any` despite a non-`Any` return type
|
||||||
warn_return_any = true
|
warn_return_any = true
|
||||||
|
|
||||||
|
# Report code that can never be reached
|
||||||
|
warn_unreachable = true
|
||||||
|
|
||||||
# Report "[[tool.mypy.overrides]]" sections that match no module
|
# Report "[[tool.mypy.overrides]]" sections that match no module
|
||||||
warn_unused_configs = true
|
warn_unused_configs = true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,10 +144,6 @@ class Location:
|
||||||
msg = "the `other` origin may only be set once"
|
msg = "the `other` origin may only be set once"
|
||||||
raise RuntimeError(msg)
|
raise RuntimeError(msg)
|
||||||
|
|
||||||
if not isinstance(other, Location):
|
|
||||||
msg = "`other` is not a `Location` object"
|
|
||||||
raise TypeError(msg)
|
|
||||||
|
|
||||||
if self.zone != other.zone:
|
if self.zone != other.zone:
|
||||||
msg = "`other` must be in the same zone, including the band"
|
msg = "`other` must be in the same zone, including the band"
|
||||||
raise ValueError(msg)
|
raise ValueError(msg)
|
||||||
|
|
|
||||||
|
|
@ -169,11 +169,6 @@ class TestRelateTo:
|
||||||
with pytest.raises(RuntimeError, match="once"):
|
with pytest.raises(RuntimeError, match="once"):
|
||||||
location.relate_to(origin)
|
location.relate_to(origin)
|
||||||
|
|
||||||
def test_call_relate_to_with_wrong_other_type(self, location):
|
|
||||||
"""`other` must be another `Location`."""
|
|
||||||
with pytest.raises(TypeError, match="Location"):
|
|
||||||
location.relate_to(object())
|
|
||||||
|
|
||||||
def test_call_relate_to_with_far_away_other(
|
def test_call_relate_to_with_far_away_other(
|
||||||
self,
|
self,
|
||||||
location,
|
location,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue