Changed FilterTest namedtuples to dataclasses (#37252)
This commit is contained in:
parent
86c27b50f1
commit
b78f163bb0
4 changed files with 47 additions and 13 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue