diff --git a/smart_open/tests/test_smart_open.py b/smart_open/tests/test_smart_open.py index e31f48b7..789f44c6 100644 --- a/smart_open/tests/test_smart_open.py +++ b/smart_open/tests/test_smart_open.py @@ -607,6 +607,22 @@ def test_atplus(self): self.assertEqual(text, SAMPLE_TEXT * 2) +class CompressionRealFileSystemTests(RealFileSystemTests): + """Same as RealFileSystemTests but with a compressed file.""" + + def setUp(self): + with named_temporary_file(prefix='test', suffix='.zst', delete=False) as fout: + self.temp_file = fout.name + with smart_open.open(self.temp_file, 'wb') as fout: + fout.write(SAMPLE_BYTES) + + def test_aplus(self): + pass # transparent (de)compression unsupported for mode 'ab+' + + def test_atplus(self): + pass # transparent (de)compression unsupported for mode 'ab+' + + # # What exactly to patch here differs on _how_ we're opening the file. # See the _shortcut_open function for details. diff --git a/smart_open/utils.py b/smart_open/utils.py index 2be57d19..c06e2cf0 100644 --- a/smart_open/utils.py +++ b/smart_open/utils.py @@ -208,6 +208,8 @@ def __exit__(self, exc_type, exc_val, exc_tb): class FileLikeProxy(wrapt.ObjectProxy): + __inner = ... # initialized before wrapt disallows __setattr__ on certain objects + def __init__(self, outer, inner): super().__init__(outer) self.__inner = inner