Skip to content

Commit edd090e

Browse files
committed
Added Mounted type tests
1 parent 27cd00b commit edd090e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import pytest
2+
3+
from ..mountedtype import MountedType
4+
from ..field import Field
5+
from ..scalars import String
6+
7+
8+
class CustomField(Field):
9+
def __init__(self, *args, **kwargs):
10+
self.metadata = kwargs.pop('metadata', None)
11+
super(CustomField, self).__init__(*args, **kwargs)
12+
13+
14+
def test_mounted_type():
15+
unmounted = String()
16+
mounted = Field.mount(unmounted)
17+
assert isinstance(mounted, Field)
18+
assert mounted.type == String
19+
20+
21+
def test_mounted_type_custom():
22+
unmounted = String(metadata={'hey': 'yo!'})
23+
mounted = CustomField.mount(unmounted)
24+
assert isinstance(mounted, CustomField)
25+
assert mounted.type == String
26+
assert mounted.metadata == {'hey': 'yo!'}

0 commit comments

Comments
 (0)