From 286c25be9e448e9d8345bc2084d449bbe822cf4d Mon Sep 17 00:00:00 2001 From: Kemal Hadimli Date: Fri, 28 Jul 2023 10:20:26 +0100 Subject: [PATCH 1/4] fix: Move round trip test from pb --- tests/schema/test_round_trip.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/schema/test_round_trip.py diff --git a/tests/schema/test_round_trip.py b/tests/schema/test_round_trip.py new file mode 100644 index 0000000..16f038c --- /dev/null +++ b/tests/schema/test_round_trip.py @@ -0,0 +1,22 @@ +import pyarrow as pa +from cloudquery.plugin_v3 import arrow + + +def test_schema_round_trip(): + sc = pa.schema( + fields=[pa.field("a", pa.int64())], metadata={"foo": "bar", "baz": "quux"} + ) + b = arrow.schemas_to_bytes([sc]) + schemas = arrow.new_schemas_from_bytes(b) + assert len(schemas) == 1 + assert schemas[0].equals(sc) + + +def test_record_round_trip(): + sc = pa.schema( + fields=[pa.field("a", pa.int64())], metadata={"foo": "bar", "baz": "quux"} + ) + rec = pa.RecordBatch.from_arrays([pa.array([1, 2, 3])], schema=sc) + b = arrow.record_to_bytes(rec) + rec2 = arrow.new_record_from_bytes(b) + assert rec.equals(rec2) From ee7a837ed326b4a765332ef439afb28c2b78cae2 Mon Sep 17 00:00:00 2001 From: Kemal Hadimli Date: Fri, 28 Jul 2023 11:09:44 +0100 Subject: [PATCH 2/4] pytest to consider all files in tests/ --- pytest.ini | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 pytest.ini diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..8a720a4 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +python_files = tests/*.py \ No newline at end of file From fcd44812f4d80d305ba71dab874173bc7459d9ba Mon Sep 17 00:00:00 2001 From: Kemal Hadimli Date: Fri, 28 Jul 2023 11:14:35 +0100 Subject: [PATCH 3/4] oops --- tests/schema/test_round_trip.py | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 tests/schema/test_round_trip.py diff --git a/tests/schema/test_round_trip.py b/tests/schema/test_round_trip.py deleted file mode 100644 index 16f038c..0000000 --- a/tests/schema/test_round_trip.py +++ /dev/null @@ -1,22 +0,0 @@ -import pyarrow as pa -from cloudquery.plugin_v3 import arrow - - -def test_schema_round_trip(): - sc = pa.schema( - fields=[pa.field("a", pa.int64())], metadata={"foo": "bar", "baz": "quux"} - ) - b = arrow.schemas_to_bytes([sc]) - schemas = arrow.new_schemas_from_bytes(b) - assert len(schemas) == 1 - assert schemas[0].equals(sc) - - -def test_record_round_trip(): - sc = pa.schema( - fields=[pa.field("a", pa.int64())], metadata={"foo": "bar", "baz": "quux"} - ) - rec = pa.RecordBatch.from_arrays([pa.array([1, 2, 3])], schema=sc) - b = arrow.record_to_bytes(rec) - rec2 = arrow.new_record_from_bytes(b) - assert rec.equals(rec2) From 8ca8d2e78ae4c524cf789760d3aae5852ed4c079 Mon Sep 17 00:00:00 2001 From: Kemal Hadimli Date: Fri, 28 Jul 2023 11:15:32 +0100 Subject: [PATCH 4/4] missing newline --- pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index 8a720a4..7dab082 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,2 +1,2 @@ [pytest] -python_files = tests/*.py \ No newline at end of file +python_files = tests/*.py