contrib/python-zstandard/tests/common.py
changeset 30444 b86a448a2965
child 30924 c32454d69b85
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/python-zstandard/tests/common.py	Thu Nov 10 22:15:58 2016 -0800
@@ -0,0 +1,15 @@
+import io
+
+class OpCountingBytesIO(io.BytesIO):
+    def __init__(self, *args, **kwargs):
+        self._read_count = 0
+        self._write_count = 0
+        return super(OpCountingBytesIO, self).__init__(*args, **kwargs)
+
+    def read(self, *args):
+        self._read_count += 1
+        return super(OpCountingBytesIO, self).read(*args)
+
+    def write(self, data):
+        self._write_count += 1
+        return super(OpCountingBytesIO, self).write(data)