当前位置: 首页>>代码示例>>Python>>正文


Python SpatialUnitFactory.build方法代码示例

本文整理汇总了Python中spatial.tests.factories.SpatialUnitFactory.build方法的典型用法代码示例。如果您正苦于以下问题:Python SpatialUnitFactory.build方法的具体用法?Python SpatialUnitFactory.build怎么用?Python SpatialUnitFactory.build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在spatial.tests.factories.SpatialUnitFactory的用法示例。


在下文中一共展示了SpatialUnitFactory.build方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_repr

# 需要导入模块: from spatial.tests.factories import SpatialUnitFactory [as 别名]
# 或者: from spatial.tests.factories.SpatialUnitFactory import build [as 别名]
 def test_repr(self):
     project = ProjectFactory.build(slug='prj')
     su1 = SpatialUnitFactory.build(type='PA', id='abc123', project=project)
     su2 = SpatialUnitFactory.build(type='PA', id='def456', project=project)
     relationship = SpatialRelationshipFactory.build(
         id='abc123',
         project=project,
         su1=su1,
         su2=su2,
         type='C')
     assert repr(relationship) == ('<SpatialRelationship id=abc123'
                                   ' project=prj su1=abc123 su2=def456'
                                   ' type=C>')
开发者ID:mikael19,项目名称:cadasta-platform,代码行数:15,代码来源:test_models.py

示例2: test_serialize

# 需要导入模块: from spatial.tests.factories import SpatialUnitFactory [as 别名]
# 或者: from spatial.tests.factories.SpatialUnitFactory import build [as 别名]
    def test_serialize(self):
        location = SpatialUnitFactory.build(id='abc123')
        serializer = serializers.SpatialUnitGeoJsonSerializer(location)

        assert 'type' in serializer.data['properties']
        assert 'url' in serializer.data['properties']
        assert 'geometry' in serializer.data
开发者ID:Cadasta,项目名称:cadasta-platform,代码行数:9,代码来源:test_serializers.py

示例3: test_get_url

# 需要导入模块: from spatial.tests.factories import SpatialUnitFactory [as 别名]
# 或者: from spatial.tests.factories.SpatialUnitFactory import build [as 别名]
    def test_get_url(self):
        location = SpatialUnitFactory.build(id='abc123')
        serializer = serializers.SpatialUnitGeoJsonSerializer(location)

        expected_url = ('/organizations/{o}/projects/{p}/records/'
                        'locations/{l}/'.format(
                            o=location.project.organization.slug,
                            p=location.project.slug,
                            l=location.id
                        ))

        assert serializer.get_url(location) == expected_url
开发者ID:Cadasta,项目名称:cadasta-platform,代码行数:14,代码来源:test_serializers.py

示例4: test_repr

# 需要导入模块: from spatial.tests.factories import SpatialUnitFactory [as 别名]
# 或者: from spatial.tests.factories.SpatialUnitFactory import build [as 别名]
 def test_repr(self):
     project = ProjectFactory.build(slug='prj')
     party = PartyFactory.build(id='abc123', project=project)
     su = SpatialUnitFactory.build(id='def456', project=project)
     relationship = TenureRelationshipFactory.build(
         id='abc123',
         project=project,
         party=party,
         spatial_unit=su,
         tenure_type=TenureRelationshipType(id='CR'))
     assert repr(relationship) == ('<TenureRelationship id=abc123'
                                   ' party=abc123 spatial_unit=def456'
                                   ' project=prj tenure_type=CR>')
开发者ID:Cadasta,项目名称:cadasta-platform,代码行数:15,代码来源:test_models.py

示例5: test_get_type

# 需要导入模块: from spatial.tests.factories import SpatialUnitFactory [as 别名]
# 或者: from spatial.tests.factories.SpatialUnitFactory import build [as 别名]
 def test_get_type(self):
     location = SpatialUnitFactory.build(type='CB')
     serializer = serializers.SpatialUnitGeoJsonSerializer(location)
     assert serializer.get_type(location) == 'Community boundary'
开发者ID:Cadasta,项目名称:cadasta-platform,代码行数:6,代码来源:test_serializers.py


注:本文中的spatial.tests.factories.SpatialUnitFactory.build方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。