<filename>test/test_default.py<gh_stars>1-10
from unittest import TestCase

from pynamodb.attributes import UnicodeAttribute
from pynamodb.models import Model

from marshmallow_pynamodb import ModelSchema


class User(Model):
    class Meta:
        table_name = "UserModel"

    email = UnicodeAttribute(default="<EMAIL>")
    first_name = UnicodeAttribute(range_key=True)
    last_name = UnicodeAttribute(hash_key=True)


class TestDefault(TestCase):
    def test_corresponding_field_has_default(self):
        class UserSchema(ModelSchema):
            class Meta:
                model = User

        self.assertEqual(
            getattr(UserSchema, "_declared_fields")["email"].missing, "<EMAIL>"
        )
