From 545acb3fabb7cfb983bf97b328603a479789a5d0 Mon Sep 17 00:00:00 2001 From: Vitaliy Mysak Date: Wed, 7 Aug 2024 11:35:50 -0700 Subject: [PATCH] Test nonreadable --- tests/test_subtextio.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_subtextio.py b/tests/test_subtextio.py index fb68afc..a56d17c 100644 --- a/tests/test_subtextio.py +++ b/tests/test_subtextio.py @@ -4,7 +4,7 @@ import pytest import os from multicsv.subtextio import SubTextIO -from multicsv.exceptions import OpOnClosedError, InvalidWhenceError, InvalidSubtextCoordinates, EndsBeyondBaseContent, BaseMustBeSeekable +from multicsv.exceptions import OpOnClosedError, InvalidWhenceError, InvalidSubtextCoordinates, EndsBeyondBaseContent, BaseMustBeSeekable, BaseMustBeReadable @pytest.fixture @@ -447,3 +447,10 @@ def seekable(self): with pytest.raises(BaseMustBeSeekable): SubTextIO(file, start=0, end=0) + +def test_not_readable(): + import tempfile + + with tempfile.NamedTemporaryFile(mode="w") as file: + with pytest.raises(BaseMustBeReadable): + SubTextIO(file, start=0, end=10)