def test_validate_record_type(fx_point, fx_record_type, fx_offset, fx_location_record): assert validate_record_type(fx_point) with raises(TypeError): validate_record_type(fx_record_type(left=fx_offset, top=1)) with raises(TypeError): validate_record_type(fx_record_type(left=1, top=fx_offset)) assert validate_record_type( fx_location_record(name=None, lat=decimal.Decimal('3.14'), lng=decimal.Decimal('1.592')))
def __init__(self, left, top): self.left = left self.top = top validate_record_type(self)
def __init__(self, left: Offset, top: Offset) -> None: self.left = left self.top = top validate_record_type(self)
def __init__(self, name, lat, lng): self.name = name self.lat = lat self.lng = lng validate_record_type(self)
def __init__(self, name: typing.Optional[str], lat: decimal.Decimal, lng: decimal.Decimal) -> None: self.name = name self.lat = lat self.lng = lng validate_record_type(self)