From 9cac0ba714a45d55e0d1b939132c6749228b28e3 Mon Sep 17 00:00:00 2001 From: libretto Date: Thu, 26 Sep 2024 19:56:34 +0300 Subject: [PATCH] fixup --- tests/unit/test_avro_merge.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/tests/unit/test_avro_merge.py b/tests/unit/test_avro_merge.py index 4d9a05286..d29c0fa48 100644 --- a/tests/unit/test_avro_merge.py +++ b/tests/unit/test_avro_merge.py @@ -15,19 +15,17 @@ class TestAvroMerge: @pytest.fixture - def setup_avro_merge(self): + def avro_merge(self): schema_str = '{"type": "record", "name": "Test", "fields": [{"name": "field1", "type": "string"}]}' dependencies = {"dependency1": MagicMock(schema=MagicMock(schema_str='{"type": "string"}', dependencies=None))} return AvroMerge(schema_str, dependencies) - def test_init(self, setup_avro_merge): - avro_merge = setup_avro_merge + def test_init(self, avro_merge): assert avro_merge.schema_str == json_encode(json_decode(avro_merge.schema_str), compact=True, sort_keys=True) - assert avro_merge.dependencies == avro_merge.dependencies assert avro_merge.unique_id == 0 - def test_union_safe_schema_str_no_union(self, setup_avro_merge): - avro_merge = setup_avro_merge + def test_union_safe_schema_str_no_union(self, avro_merge): + result = avro_merge.union_safe_schema_str('{"type": "string"}') expected = ( '{"name": "___RESERVED_KARAPACE_WRAPPER_NAME_0___","type": "record", "fields": [{"name": "name", ' @@ -35,8 +33,7 @@ def test_union_safe_schema_str_no_union(self, setup_avro_merge): ) assert result == expected - def test_union_safe_schema_str_with_union(self, setup_avro_merge): - avro_merge = setup_avro_merge + def test_union_safe_schema_str_with_union(self, avro_merge): result = avro_merge.union_safe_schema_str('["null", "string"]') expected = ( '{"name": "___RESERVED_KARAPACE_WRAPPER_NAME_0___","type": "record", "fields": [{"name": "name", ' @@ -44,8 +41,7 @@ def test_union_safe_schema_str_with_union(self, setup_avro_merge): ) assert result == expected - def test_builder_no_dependencies(self, setup_avro_merge): - avro_merge = setup_avro_merge + def test_builder_no_dependencies(self, avro_merge): avro_merge.dependencies = None result = avro_merge.builder(avro_merge.schema_str) expected = ( @@ -54,8 +50,7 @@ def test_builder_no_dependencies(self, setup_avro_merge): ) assert result == expected - def test_builder_with_dependencies(self, setup_avro_merge): - avro_merge = setup_avro_merge + def test_builder_with_dependencies(self, avro_merge): result = avro_merge.builder(avro_merge.schema_str, avro_merge.dependencies) expected = ( '{"name": "___RESERVED_KARAPACE_WRAPPER_NAME_1___","type": "record", "fields": [{"name": "name", "type": [{' @@ -66,8 +61,7 @@ def test_builder_with_dependencies(self, setup_avro_merge): ) assert result == expected - def test_wrap(self, setup_avro_merge): - avro_merge = setup_avro_merge + def test_wrap(self, avro_merge): result = avro_merge.wrap() expected = ( "[\n"