From b5a0300cf4fe69e0d3804e23623110675d5ebf48 Mon Sep 17 00:00:00 2001 From: Steven Loria Date: Mon, 29 Mar 2021 22:53:38 -0400 Subject: [PATCH] Handle warning in metadata test; remove unnecessary 'type: ignore's (#1776) --- tests/base.py | 8 ++++---- tests/test_fields.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/base.py b/tests/base.py index 3e342134a..707708cf8 100644 --- a/tests/base.py +++ b/tests/base.py @@ -155,7 +155,7 @@ def get_lowername(obj): class UserSchema(Schema): name = fields.String() - age = fields.Float() + age = fields.Float() # type: fields.Field created = fields.DateTime() created_formatted = fields.DateTime( format="%Y-%m-%d", attribute="created", dump_only=True @@ -168,7 +168,7 @@ class UserSchema(Schema): homepage = fields.Url() email = fields.Email() balance = fields.Decimal() - is_old = fields.Method("get_is_old") + is_old = fields.Method("get_is_old") # type: fields.Field lowername = fields.Function(get_lowername) registered = fields.Boolean() hair_colors = fields.List(fields.Raw) @@ -267,7 +267,7 @@ class Meta: class UserIntSchema(UserSchema): - age = fields.Integer() # type: ignore + age = fields.Integer() class UserFloatStringSchema(UserSchema): @@ -275,7 +275,7 @@ class UserFloatStringSchema(UserSchema): class ExtendedUserSchema(UserSchema): - is_old = fields.Boolean() # type: ignore + is_old = fields.Boolean() class UserRelativeUrlSchema(UserSchema): diff --git a/tests/test_fields.py b/tests/test_fields.py index 4e5e4cc01..0b52adb74 100644 --- a/tests/test_fields.py +++ b/tests/test_fields.py @@ -191,7 +191,8 @@ class Meta: class TestMetadata: @pytest.mark.parametrize("FieldClass", ALL_FIELDS) def test_extra_metadata_may_be_added_to_field(self, FieldClass): # noqa - field = FieldClass(description="Just a normal field.") + with pytest.warns(DeprecationWarning): + field = FieldClass(description="Just a normal field.") assert field.metadata["description"] == "Just a normal field." field = FieldClass( required=True,