# Path: aiokafka/record/control_record.py
# class ControlRecord:
# 
#     def __init__(self, version, type_):
#         self._version = version
#         self._type = type_
# 
#     @property
#     def version(self):
#         return self._version
# 
#     @property
#     def type_(self):
#         return self._type
# 
#     def __eq__(self, other):
#         if isinstance(other, ControlRecord):
#             return other._version == self._version and \
#                 other._type == self._type
#         return False
# 
#     @classmethod
#     def parse(cls, data: bytes, _schema=struct.Struct(">HH")):
#         version, type_ = _schema.unpack_from(data)
#         return cls(version, type_)
# 
#     def __repr__(self):
#         return "ControlRecord(version={}, type_={})".format(
#             self._version, self._type)
# 
# ABORT_MARKER = ControlRecord(0, 0)
# 
# COMMIT_MARKER = ControlRecord(0, 1)


import pytest
from aiokafka.record.control_record import \
    ControlRecord, ABORT_MARKER, COMMIT_MARKER



@pytest.mark.parametrize("data,marker", [
    (b"\x00\x00\x00\x00", ABORT_MARKER),
    (b"\x00\x00\x00\x01", COMMIT_MARKER),
])
def test_control_record_serde(data, marker):
    assert ControlRecord.parse(data) == marker


def test_control_record_parse():
    record = ControlRecord.parse(b"\x00\x01\x00\x01")
    assert record.version == 1
    assert record.type_ == 1


# Path: aiokafka/record/control_record.py
# class ControlRecord:
# 
#     def __init__(self, version, type_):
#         self._version = version
#         self._type = type_
# 
#     @property
#     def version(self):
#         return self._version
# 
#     @property
#     def type_(self):
#         return self._type
# 
#     def __eq__(self, other):
#         if isinstance(other, ControlRecord):
#             return other._version == self._version and \
#                 other._type == self._type
#         return False
# 
#     @classmethod
#     def parse(cls, data: bytes, _schema=struct.Struct(">HH")):
#         version, type_ = _schema.unpack_from(data)
#         return cls(version, type_)
# 
#     def __repr__(self):
#         return "ControlRecord(version={}, type_={})".format(
#             self._version, self._type)
# 
# ABORT_MARKER = ControlRecord(0, 0)
# 
# COMMIT_MARKER = ControlRecord(0, 1)


# Path: tests/record/test_control_record.py
import pytest
from aiokafka.record.control_record import \
    ControlRecord, ABORT_MARKER, COMMIT_MARKER




@pytest.mark.parametrize("data,marker", [
    (b"\x00\x00\x00\x00", ABORT_MARKER),
    (b"\x00\x00\x00\x01", COMMIT_MARKER),
])
def test_control_record_serde(data, marker):
    assert ControlRecord.parse(data) == marker


def test_control_record_parse():
    record = ControlRecord.parse(b"\x00\x01\x00\x01")
    assert record.version == 1
    assert record.type_ == 1


    record = ControlRecord.parse(b"\xFF\xFF\xFF\xFF")