Document some possible error messages

This commit is contained in:
Andrew Brookins 2021-11-26 15:25:18 -08:00
parent 60fbd09775
commit e4e3583006
5 changed files with 262 additions and 25 deletions

View file

@ -1,9 +1,11 @@
# type: ignore
import abc
import dataclasses
import datetime
import decimal
from collections import namedtuple
from typing import Optional, Dict, Set, List
from typing import Dict, List, Optional, Set
from unittest import mock
import pytest
@ -372,24 +374,28 @@ def test_raises_error_with_dataclasses(m):
address_line_1: str
with pytest.raises(RedisModelError):
class InvalidMember(m.BaseHashModel):
address: Address
def test_raises_error_with_dicts(m):
with pytest.raises(RedisModelError):
class InvalidMember(m.BaseHashModel):
address: Dict[str, str]
def test_raises_error_with_sets(m):
with pytest.raises(RedisModelError):
class InvalidMember(m.BaseHashModel):
friend_ids: Set[str]
def test_raises_error_with_lists(m):
with pytest.raises(RedisModelError):
class InvalidMember(m.BaseHashModel):
friend_ids: List[str]

View file

@ -1,9 +1,11 @@
# type: ignore
import abc
import dataclasses
import datetime
import decimal
from collections import namedtuple
from typing import List, Optional, Set, Dict
from typing import Dict, List, Optional, Set
from unittest import mock
import pytest
@ -687,7 +689,7 @@ async def test_allows_and_serializes_dicts(m):
member2 = await ValidMember.get(member.pk)
assert member2 == member
assert member2.address['address_line_1'] == "hey"
assert member2.address["address_line_1"] == "hey"
@pytest.mark.asyncio