Renamed from MountedType.mount to MuntedType.mounted

This commit is contained in:
Syrus Akbary 2016-12-18 14:03:03 -08:00
parent dda3237e0a
commit 573101fc90
5 changed files with 6 additions and 6 deletions

View File

@ -47,7 +47,7 @@ def to_arguments(args, extra_args=None):
continue continue
if isinstance(arg, UnmountedType): if isinstance(arg, UnmountedType):
arg = Argument.mount(arg) arg = Argument.mounted(arg)
if isinstance(arg, (InputField, Field)): if isinstance(arg, (InputField, Field)):
raise ValueError('Expected {} to be Argument, but received {}. Try using Argument({}).'.format( raise ValueError('Expected {} to be Argument, but received {}. Try using Argument({}).'.format(

View File

@ -5,7 +5,7 @@ from .unmountedtype import UnmountedType
class MountedType(OrderedType): class MountedType(OrderedType):
@classmethod @classmethod
def mount(cls, unmounted): # noqa: N802 def mounted(cls, unmounted): # noqa: N802
''' '''
Mount the UnmountedType instance Mount the UnmountedType instance
''' '''

View File

@ -13,14 +13,14 @@ class CustomField(Field):
def test_mounted_type(): def test_mounted_type():
unmounted = String() unmounted = String()
mounted = Field.mount(unmounted) mounted = Field.mounted(unmounted)
assert isinstance(mounted, Field) assert isinstance(mounted, Field)
assert mounted.type == String assert mounted.type == String
def test_mounted_type_custom(): def test_mounted_type_custom():
unmounted = String(metadata={'hey': 'yo!'}) unmounted = String(metadata={'hey': 'yo!'})
mounted = CustomField.mount(unmounted) mounted = CustomField.mounted(unmounted)
assert isinstance(mounted, CustomField) assert isinstance(mounted, CustomField)
assert mounted.type == String assert mounted.type == String
assert mounted.metadata == {'hey': 'yo!'} assert mounted.metadata == {'hey': 'yo!'}

View File

@ -28,7 +28,7 @@ class UnmountedType(OrderedType):
raise NotImplementedError("get_type not implemented in {}".format(self)) raise NotImplementedError("get_type not implemented in {}".format(self))
def mount_as(self, _as): def mount_as(self, _as):
return _as.mount(self) return _as.mounted(self)
def Field(self): # noqa: N802 def Field(self): # noqa: N802
''' '''

View File

@ -42,7 +42,7 @@ def get_field_as(value, _as=None):
elif isinstance(value, UnmountedType): elif isinstance(value, UnmountedType):
if _as is None: if _as is None:
return value return value
return _as.mount(value) return _as.mounted(value)
def yank_fields_from_attrs(attrs, _as=None, delete=True, sort=True): def yank_fields_from_attrs(attrs, _as=None, delete=True, sort=True):