You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by bl...@apache.org on 2022/08/03 16:57:38 UTC

[iceberg] branch master updated: Python: Add and cleanup tests (#5422)

This is an automated email from the ASF dual-hosted git repository.

blue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/master by this push:
     new f94370d13e Python: Add and cleanup tests (#5422)
f94370d13e is described below

commit f94370d13e5f4230f35cba7a4d9593c436619498
Author: Fokko Driesprong <fo...@apache.org>
AuthorDate: Wed Aug 3 18:57:34 2022 +0200

    Python: Add and cleanup tests (#5422)
---
 python/pyiceberg/catalog/rest.py   | 14 -------------
 python/tests/avro/test_resolver.py | 40 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 14 deletions(-)

diff --git a/python/pyiceberg/catalog/rest.py b/python/pyiceberg/catalog/rest.py
index afac2dd6c7..c68f4468b5 100644
--- a/python/pyiceberg/catalog/rest.py
+++ b/python/pyiceberg/catalog/rest.py
@@ -21,7 +21,6 @@ from typing import (
     Literal,
     Optional,
     Set,
-    Tuple,
     Type,
     Union,
 )
@@ -191,19 +190,6 @@ class RestCatalog(Catalog):
         self.config = self._fetch_config(properties)
         super().__init__(name, properties)
 
-    @staticmethod
-    def _split_credential(token: str) -> Tuple[str, str]:
-        """Splits the token in a client id and secret
-
-        Args:
-            token: The token with a semicolon as a separator
-
-        Returns:
-            The client id and secret
-        """
-        client, secret = token.split(":")
-        return client, secret
-
     @property
     def headers(self) -> Properties:
         headers = {
diff --git a/python/tests/avro/test_resolver.py b/python/tests/avro/test_resolver.py
index 3b51a4ab48..8c1309d620 100644
--- a/python/tests/avro/test_resolver.py
+++ b/python/tests/avro/test_resolver.py
@@ -177,6 +177,46 @@ def test_promote_decimal_to_decimal():
     assert promote(DecimalType(19, 25), DecimalType(22, 25)) == DecimalReader(22, 25)
 
 
+def test_struct_not_aligned():
+    with pytest.raises(ResolveException):
+        assert promote(StructType(), StringType())
+
+
+def test_map_not_aligned():
+    with pytest.raises(ResolveException):
+        assert promote(MapType(1, StringType(), 2, IntegerType()), StringType())
+
+
+def test_primitive_not_aligned():
+    with pytest.raises(ResolveException):
+        assert promote(IntegerType(), MapType(1, StringType(), 2, IntegerType()))
+
+
+def test_integer_not_aligned():
+    with pytest.raises(ResolveException):
+        assert promote(IntegerType(), StringType())
+
+
+def test_float_not_aligned():
+    with pytest.raises(ResolveException):
+        assert promote(FloatType(), StringType())
+
+
+def test_string_not_aligned():
+    with pytest.raises(ResolveException):
+        assert promote(StringType(), FloatType())
+
+
+def test_binary_not_aligned():
+    with pytest.raises(ResolveException):
+        assert promote(BinaryType(), FloatType())
+
+
+def test_decimal_not_aligned():
+    with pytest.raises(ResolveException):
+        assert promote(DecimalType(22, 19), StringType())
+
+
 def test_promote_decimal_to_decimal_reduce_precision():
     # DecimalType(P, S) to DecimalType(P2, S) where P2 > P
     with pytest.raises(ResolveException) as exc_info: