Support deprecated message and fields (#126)

This commit is contained in:
Arun Babu Neelicattu
2020-07-30 14:47:01 +02:00
committed by GitHub
parent beafc812ff
commit 0cd9510b54
7 changed files with 82 additions and 0 deletions

26
tests/test_deprecated.py Normal file
View File

@@ -0,0 +1,26 @@
import pytest
from tests.output_betterproto.deprecated import Test as DeprecatedMessageTest
from tests.output_betterproto.deprecated_field import Test as DeprecatedFieldTest
def test_deprecated_message():
with pytest.deprecated_call():
DeprecatedMessageTest(value=10)
def test_deprecated_message_with_deprecated_field():
with pytest.warns(None) as record:
DeprecatedMessageTest(v=10, value=10)
assert len(record) == 2
def test_deprecated_field_warning():
with pytest.deprecated_call():
DeprecatedFieldTest(v=10, value=10)
def test_deprecated_field_no_warning():
with pytest.warns(None) as record:
DeprecatedFieldTest(value=10)
assert not record