Skip to content

Commit

Permalink
Add clarifying comments in test code
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-s committed May 9, 2024
1 parent 263008b commit 999984f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,15 @@ class PreferenceSchema(ModelSchema):

preference = Preference.objects.create(
name="Jordan",
preferred_food="ba",
preferred_group=1,
preferred_sport="",
preferred_musician=None,
)
assert PreferenceSchema.from_django(preference).model_dump() == {
"id": 1,
"name": "Jordan",
# default choice dumped
"preferred_food": "ba",
# default choice dumped
"preferred_group": 1,
"preferred_sport": "",
"preferred_musician": None,
Expand All @@ -304,6 +304,12 @@ class PreferenceSchema2(ModelSchema):

@pytest.mark.django_db
def test_listing():
"""
Testing the following properties for a field.
- nullable foreign key
- array field
"""

class ListingSchema(ModelSchema):
model_config = ConfigDict(model=Listing, use_enum_values=True)

Expand Down

0 comments on commit 999984f

Please sign in to comment.