def test_is_fp_closed_object_has_fp(self): class FpFile(object): @property def fp(self): return True assert not is_fp_closed(FpFile())
def test_is_fp_closed_object_supports_closed(self): class ClosedFile(object): @property def closed(self): return True assert is_fp_closed(ClosedFile())
def test_is_fp_closed_object_has_none_fp(self): class NoneFpFile(object): @property def fp(self): return None assert is_fp_closed(NoneFpFile())
def test_is_fp_closed_object_has_fp(self) -> None: class FpFile: @property def fp(self) -> "Literal[True]": return True assert not is_fp_closed(FpFile())
def test_is_fp_closed_object_supports_closed(self) -> None: class ClosedFile: @property def closed(self) -> "Literal[True]": return True assert is_fp_closed(ClosedFile())
def test_is_fp_closed_object_has_neither_fp_nor_closed(self): class NotReallyAFile: pass with pytest.raises(ValueError): is_fp_closed(NotReallyAFile())
def test_is_fp_closed_object_has_neither_fp_nor_closed(self): class NotReallyAFile(object): pass with pytest.raises(ValueError): is_fp_closed(NotReallyAFile())