aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2022-08-02 22:29:28 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2022-08-24 19:25:23 +0300
commit17b4c757a86be1c7b5607215076d07e0433cee09 (patch)
treed45eea9685df083c2efd22fbd3ea7c0f9c20bb5f /tests
parenttest/*.py: various modernization of code (diff)
downloadsnakeoil-17b4c757a86be1c7b5607215076d07e0433cee09.tar.gz
snakeoil-17b4c757a86be1c7b5607215076d07e0433cee09.tar.bz2
snakeoil-17b4c757a86be1c7b5607215076d07e0433cee09.zip
stringio: remove text_writable & bytes_writable
Was already marked for deprecation, but not yet removed. Use instead io.StringIO and io.BytesIO. Also use metaclass for _make_ro_cls. Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_stringio.py28
1 files changed, 2 insertions, 26 deletions
diff --git a/tests/test_stringio.py b/tests/test_stringio.py
index 0aa6e68..4fb7c78 100644
--- a/tests/test_stringio.py
+++ b/tests/test_stringio.py
@@ -1,10 +1,11 @@
# TODO: deprecated, remove in 0.9.0
import pytest
+
from snakeoil import stringio
-class base:
+class readonly_mixin:
encoding = None
kls = None
@@ -19,9 +20,6 @@ class base:
return data
return data.decode(self.encoding)
-
-class readonly_mixin(base):
-
def test_nonwritable(self):
convert = self.convert_data
obj = self.kls(convert("adsf"))
@@ -33,31 +31,9 @@ class readonly_mixin(base):
obj.truncate()
-class writable_mixin(base):
-
- def test_writable(self):
- convert = self.convert_data
- obj = self.kls(convert("bow ties"))
- assert obj.getvalue() == convert("bow ties")
- # assert we start at 0
- assert obj.tell() == 0
- obj.write(convert("are cool"))
- assert obj.getvalue() == convert("are cool")
- obj.seek(0)
- obj.truncate(0)
- assert obj.getvalue() == convert("")
-
-
class Test_text_readonly(readonly_mixin):
kls = stringio.text_readonly
-class Test_text_writable(writable_mixin):
- kls = stringio.text_writable
-
class Test_bytes_readonly(readonly_mixin ):
kls = stringio.bytes_readonly
encoding = 'utf8'
-
-class Test_bytes_writable(writable_mixin ):
- kls = stringio.bytes_writable
- encoding = 'utf8'