File: test_api_object_implementation.py

package info (click to toggle)
python-kafka 2.0.2-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,740 kB
  • sloc: python: 20,457; makefile: 210; sh: 76
file content (18 lines) | stat: -rw-r--r-- 704 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import abc
import pytest

from kafka.protocol.api import Request
from kafka.protocol.api import Response


attr_names = [n for n in dir(Request) if isinstance(getattr(Request, n), abc.abstractproperty)]
@pytest.mark.parametrize('klass', Request.__subclasses__())
@pytest.mark.parametrize('attr_name', attr_names)
def test_request_type_conformance(klass, attr_name):
    assert hasattr(klass, attr_name)

attr_names = [n for n in dir(Response) if isinstance(getattr(Response, n), abc.abstractproperty)]
@pytest.mark.parametrize('klass', Response.__subclasses__())
@pytest.mark.parametrize('attr_name', attr_names)
def test_response_type_conformance(klass, attr_name):
    assert hasattr(klass, attr_name)