Changed FilterTest namedtuples to dataclasses (#37252)

This commit is contained in:
mdegat01 authored and GitHub committed 2020-06-30 11:59:21 -05:00
1 parent 86c27b50f1
commit b78f163bb0
4 files changed
+47 -13

No files matched your search

+20 -3
View File
@@ -1,5 +1,7 @@
"""The tests for the Apache Kafka component."""
from collections import namedtuple
from asyncio import AbstractEventLoop
from dataclasses import dataclass
from typing import Callable, Type
import pytest
@@ -16,8 +18,23 @@ MIN_CONFIG = {
"port": 8080,
"topic": "topic",
}
FilterTest = namedtuple("FilterTest", "id should_pass")
MockKafkaClient = namedtuple("MockKafkaClient", "init start send_and_wait")
@dataclass
class FilterTest:
"""Class for capturing a filter test."""
id: str
should_pass: bool
@dataclass
class MockKafkaClient:
"""Mock of the Apache Kafka client for testing."""
init: Callable[[Type[AbstractEventLoop], str, str], None]
start: Callable[[], None]
send_and_wait: Callable[[str, str], None]
@pytest.fixture(name="mock_client")