rdblue commented on a change in pull request #3691:
URL: https://github.com/apache/iceberg/pull/3691#discussion_r781354151



##########
File path: python/tests/io/test_base.py
##########
@@ -0,0 +1,116 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import io
+
+from iceberg.io.base import FileIO, InputFile, OutputFile
+
+
+class FooInputFile(InputFile):
+    def __len__(self):
+        return io.BytesIO(b"foo").getbuffer().nbytes
+
+    def exists(self):
+        return True
+
+    def __enter__(self):
+        super().__enter__()
+        return io.BytesIO(b"foo")
+
+    def __exit__(self, exc_type, exc_value, exc_traceback):
+        super().__exit__(exc_type, exc_value, exc_traceback)
+        return
+
+
+class FooOutputFile(OutputFile):
+    def __call__(self, overwrite: bool = False, **kwargs):
+        super().__call__(overwrite=True)
+        return self
+
+    def __len__(self):
+        return len(self._file_obj)
+
+    def exists(self):
+        return True
+
+    def to_input_file(self):
+        return FooInputFile(location=self.location)
+
+    def __enter__(self):
+        self._mock_storage = io.BytesIO()
+        return self._mock_storage
+
+    def __exit__(self, exc_type, exc_value, exc_traceback):
+        super().__exit__(exc_type, exc_value, exc_traceback)
+        return
+
+
+class FooFileIO(FileIO):

Review comment:
       I think the LocalFileIO in Java is in tests only. We probably don't want 
to have anyone use it in production, but it's a great way to test.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to