From 24f6006b09340182eed8f7697e7551fba00800f9 Mon Sep 17 00:00:00 2001 From: Emily Rockman Date: Tue, 30 Jan 2024 09:42:02 -0600 Subject: [PATCH] actually run precommit --- tests/unit/test_events.py | 5 ++--- tests/unit/test_proto_events.py | 8 ++------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/tests/unit/test_events.py b/tests/unit/test_events.py index 4130bb15..aaa993e4 100644 --- a/tests/unit/test_events.py +++ b/tests/unit/test_events.py @@ -27,7 +27,6 @@ def get_all_subclasses(cls): class TestEventCodes: - # checks to see if event codes are duplicated to keep codes singluar and clear. # also checks that event codes follow correct namming convention ex. E001 def test_event_codes(self): @@ -63,7 +62,6 @@ def test_event_codes(self): class TestEventJSONSerialization: - # attempts to test that every event is serializable to json. # event types that take `Any` are not possible to test in this way since some will serialize # just fine and others won't. @@ -79,7 +77,7 @@ def test_all_serializable(self): # make sure everything in the list is a value not a type for event in sample_values: - assert type(event) != type + assert not isinstance(event, type) # if we have everything we need to test, try to serialize everything count = 0 @@ -108,6 +106,7 @@ def test_all_serializable(self): count += 1 print(f"--- Found {count} events") + def test_bad_serialization(): """Tests that bad serialization enters the proper exception handling diff --git a/tests/unit/test_proto_events.py b/tests/unit/test_proto_events.py index e29675d7..32eb08ae 100644 --- a/tests/unit/test_proto_events.py +++ b/tests/unit/test_proto_events.py @@ -1,10 +1,7 @@ from dbt_common.events.functions import msg_to_dict, msg_to_json, reset_metadata_vars from dbt_common.events import types_pb2 from dbt_common.events.base_types import msg_from_base_event -from dbt_common.events.types import ( - RetryExternalCall -) -from dbt_common.events import types_pb2 +from dbt_common.events.types import RetryExternalCall from google.protobuf.json_format import MessageToDict info_keys = { @@ -22,7 +19,6 @@ def test_events(): - # M020 event event_code = "M020" event = RetryExternalCall(attempt=3, max=5) @@ -48,8 +44,8 @@ def test_events(): assert new_msg.info.code == msg.info.code assert new_msg.data.attempt == msg.data.attempt -def test_extra_dict_on_event(monkeypatch): +def test_extra_dict_on_event(monkeypatch): monkeypatch.setenv("DBT_ENV_CUSTOM_ENV_env_key", "env_value") reset_metadata_vars()