本文整理汇总了Python中treemap.tests.make_instance函数的典型用法代码示例。如果您正苦于以下问题:Python make_instance函数的具体用法?Python make_instance怎么用?Python make_instance使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了make_instance函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
self.p = Point(-8515941.0, 4953519.0)
self.instances = [
make_instance(point=self.p),
make_instance(point=self.p)
]
self.commander_users = [
make_commander_user(i, username='commander%d' % i.pk)
for i in self.instances]
for i in range(len(self.instances)):
set_write_permissions(self.instances[i], self.commander_users[i],
'Plot', ['udf:Test choice'])
self.choice_udfds = [
UserDefinedFieldDefinition.objects.create(
instance=i,
model_type='Plot',
datatype=json.dumps({'type': 'choice',
'choices': ['a', 'b', 'c']}),
iscollection=False,
name='Test choice') for i in self.instances]
self.plots = [
Plot(geom=self.p, instance=i) for i in self.instances]
for i in range(len(self.plots)):
self.plots[i].save_with_user(self.commander_users[i])
psycopg2.extras.register_hstore(connection.cursor(), globally=True)
开发者ID:riromu,项目名称:otm-core,代码行数:28,代码来源:test_udfs.py
示例2: setUp
def setUp(self):
region = ITreeRegion.objects.get(code='NoEastXXX')
p = region.geometry.point_on_surface
self.instance = make_instance(is_public=True, point=p)
self.user = make_commander_user(self.instance)
self.species = Species(otm_code='CEAT',
genus='cedrus',
species='atlantica',
max_dbh=2000,
max_height=100,
instance=self.instance)
self.species.save_with_user(self.user)
self.plot = Plot(geom=p, instance=self.instance)
self.plot.save_with_user(self.user)
self.tree = Tree(plot=self.plot,
instance=self.instance,
readonly=False,
species=self.species,
diameter=1630)
self.tree.save_with_user(self.user)
开发者ID:ahinz,项目名称:OpenTreeMap-cloud,代码行数:27,代码来源:ecobenefits.py
示例3: setUp
def setUp(self):
self.instance = make_instance()
self.commander = make_commander_user(self.instance, "comm")
# Note unicode '⅀' is on purpose
self.user1 = User(username='estraven', password='estraven',
email='[email protected]',
organization='org111',
first_name='therem', last_name='⅀straven')
self.user1.save_with_user(self.commander)
self.user2 = User(username='genly', password='genly',
email='[email protected]',
first_name='genly', last_name='ai')
self.user2.save_with_user(self.commander)
self.user3 = User(username='argaven_xv', password='argaven_xv',
email='[email protected]')
self.user3.save_with_user(self.commander)
self.user4 = User(username='faxe', password='faxe',
email='[email protected]')
self.user4.save_with_user(self.commander)
self.factory = RequestFactory()
开发者ID:OpenTreeMap,项目名称:otm-core,代码行数:26,代码来源:test_roles.py
示例4: setUp
def setUp(self):
self.instance = make_instance()
self.user = make_user(username='user')
self.instance_user = make_user(self.instance, 'instance_user')
self.client.get('/accounts/logout/')
开发者ID:HackMichiana,项目名称:otm-core,代码行数:7,代码来源:auth.py
示例5: setUp
def setUp(self):
self.instance = make_instance()
datatype = [
{'type': 'choice', 'choices': ['love', 'hug'], 'name': 'action'},
{'type': 'int', 'name': 'times'},
{'type': 'date', 'name': 'day'},
]
create_stewardship_udfs(self.instance)
make_collection_udf(self.instance, model='Plot', name='Caring',
datatype=datatype)
make_collection_udf(self.instance, model='Tree', name='Caring',
datatype=datatype)
UserDefinedFieldDefinition.objects.create(
instance=self.instance,
model_type='Plot',
datatype=json.dumps({'type': 'string'}),
iscollection=False,
name='Name')
UserDefinedFieldDefinition.objects.create(
instance=self.instance,
model_type='Tree',
datatype=json.dumps({'type': 'int'}),
iscollection=False,
name='Man Units')
开发者ID:JoshIUSBStudent,项目名称:otm-core,代码行数:26,代码来源:test_instance.py
示例6: setUp
def setUp(self):
self.instance = make_instance()
self.user = make_commander_user(self.instance)
self.plot = Plot(instance=self.instance, geom=Point(-7615441, 5953519))
self.plot.save_with_user(self.user)
self.tree = Tree(instance=self.instance, plot=self.plot)
self.tree.save_with_user(self.user)
开发者ID:ahinz,项目名称:OpenTreeMap-cloud,代码行数:7,代码来源:units.py
示例7: setUp
def setUp(self):
self.instance = make_instance()
self.user = make_commander_user(self.instance)
self.plot = Plot(instance=self.instance, geom=self.instance.center)
self.plot.save_with_user(self.user)
self.tree = Tree(instance=self.instance, plot=self.plot)
self.tree.save_with_user(self.user)
开发者ID:HackMichiana,项目名称:otm-core,代码行数:7,代码来源:test_units.py
示例8: setUp
def setUp(self):
self.p = Point(-7615441.0, 5953519.0)
self.instance = make_instance(point=self.p)
self.user = make_commander_user(self.instance)
self.plot = Plot(geom=self.instance.center, instance=self.instance)
开发者ID:jwalgran,项目名称:otm-core,代码行数:7,代码来源:test_models.py
示例9: setUp
def setUp(self):
self.instance = make_instance()
self.user = make_user(username='user', password='user')
self.role = Role(name='role', instance=self.instance, rep_thresh=0)
self.role.save()
self.user_perm, __ = FieldPermission.objects.get_or_create(
model_name='Plot', field_name='width',
permission_level=FieldPermission.NONE,
role=self.role, instance=self.instance)
iuser = InstanceUser(instance=self.instance, user=self.user,
role=self.role)
iuser.save_with_user(self.user)
inst_role = Role(name='inst def role',
instance=self.instance,
rep_thresh=0)
inst_role.save()
self.inst_perm, __ = FieldPermission.objects.get_or_create(
model_name='Plot', field_name='width',
permission_level=FieldPermission.NONE,
role=inst_role, instance=self.instance)
self.instance.default_role = inst_role
self.instance.save()
self.plot = Plot(instance=self.instance)
开发者ID:JoshIUSBStudent,项目名称:otm-core,代码行数:31,代码来源:test_templatetags.py
示例10: test_anonymous_boundary_thumbprint
def test_anonymous_boundary_thumbprint(self):
make_simple_boundary('n', n=0)
instance = make_instance()
thumbprint1 = instance.boundary_thumbprint
make_anonymous_boundary(n=1)
thumbprint2 = instance.boundary_thumbprint
self.assertEqual(thumbprint1, thumbprint2)
开发者ID:OpenTreeMap,项目名称:otm-core,代码行数:7,代码来源:test_instance.py
示例11: test_user_audits
def test_user_audits(self):
self.instance = make_instance()
username = make_commander_user(self.instance).username
self.assert_template("/users/%s/edits/" % username, "treemap/recent_user_edits.html")
self.assert_template(
"/users/%s/edits/?instance_id=%s" % (username, self.instance.id), "treemap/recent_user_edits.html"
)
开发者ID:heath,项目名称:OTM2,代码行数:7,代码来源:urls.py
示例12: setupTreemapEnv
def setupTreemapEnv():
def local_render_to_response(*args, **kwargs):
from django.template import loader
from django.http import HttpResponse
httpresponse_kwargs = {'mimetype': kwargs.pop('mimetype', None)}
hr = HttpResponse(
loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
if hasattr(args[1], 'dicts'):
hr.request_context = args[1].dicts
return hr
django.shortcuts.render_to_response = local_render_to_response
instance = make_instance(is_public=True)
create_stewardship_udfs(instance)
make_user_with_default_role(instance, 'jim')
commander = make_commander_user(instance, 'commander')
make_apprentice_user(instance, 'apprentice')
n1geom = MultiPolygon(Polygon(
((0, 0), (100, 0), (100, 100), (0, 100), (0, 0))))
n2geom = MultiPolygon(
Polygon(((0, 101), (101, 101), (101, 200), (0, 200), (0, 101))))
n1 = Boundary(name="n1", category='blah', sort_order=4, geom=n1geom)
n2 = Boundary(name="n2", category='blah', sort_order=4, geom=n2geom)
n1.save()
n2.save()
s1 = Species(otm_code="s1", genus="testus1", species="specieius1",
cultivar='', instance=instance)
s2 = Species(otm_code="s2", genus="testus2", species="specieius2",
cultivar='', instance=instance)
s3 = Species(otm_code="s3", genus="testus2", species="specieius3",
cultivar='', instance=instance)
s1.is_native = True
s1.fall_conspicuous = True
s1.flower_conspicuous = True
s1.palatable_human = True
s2.is_native = True
s2.fall_conspicuous = False
s2.flower_conspicuous = True
s2.palatable_human = False
s2.has_wildlife_value = True
s3.has_wildlife_value = True
s1.save_with_user(commander)
s2.save_with_user(commander)
s3.save_with_user(commander)
return instance
开发者ID:JoshIUSBStudent,项目名称:otm-core,代码行数:60,代码来源:test_utils.py
示例13: test_two_boundary_thumbprint
def test_two_boundary_thumbprint(self):
make_simple_boundary('n1', n=0)
instance = make_instance()
thumbprint1 = instance.boundary_thumbprint
make_simple_boundary('n2', n=1)
thumbprint2 = instance.boundary_thumbprint
self.assertNotEqual(thumbprint1, thumbprint2)
开发者ID:OpenTreeMap,项目名称:otm-core,代码行数:7,代码来源:test_instance.py
示例14: setUp
def setUp(self):
self.user = make_user(username='test', password='password')
self.instance = make_instance()
# Create an admin user to verify that not all admins get notifications
self.admin = make_user(instance=self.instance, username='admin',
admin=True)
开发者ID:OpenTreeMap,项目名称:otm-core,代码行数:7,代码来源:test_instance_invitations.py
示例15: setUp
def setUp(self):
self.p1 = Point(0, 0)
self.instance = make_instance(point=self.p1)
self.commander = make_commander_user(self.instance)
self.parse_dict_value = partial(
search._parse_dict_value_for_mapping,
search.PREDICATE_TYPES)
开发者ID:OpenTreeMap,项目名称:otm-core,代码行数:7,代码来源:test_search.py
示例16: setUp
def setUp(self):
super(CommentTestMixin, self).setUp()
self.instance = make_instance()
self.user = make_commander_user(self.instance)
self.admin = make_admin_user(self.instance)
self.plot = Plot(geom=self.instance.center, instance=self.instance)
self.plot.save_with_user(self.user)
开发者ID:JoshIUSBStudent,项目名称:otm-core,代码行数:7,代码来源:tests.py
示例17: test_boundary_thumbprint
def test_boundary_thumbprint(self):
b = make_simple_boundary('n', n=0)
instance = make_instance()
thumbprint1 = instance.boundary_thumbprint
b.name = 'n1'
b.save()
thumbprint2 = instance.boundary_thumbprint
self.assertNotEqual(thumbprint1, thumbprint2)
开发者ID:OpenTreeMap,项目名称:otm-core,代码行数:8,代码来源:test_instance.py
示例18: setUp
def setUp(self):
self.instance = make_instance()
self.user_a = make_plain_user('a', 'a')
self.user_b = make_plain_user('b', 'b')
self.plan_a1 = self._make_plan('a1', self.user_a, True)
self.plan_a2 = self._make_plan('a2', self.user_a, False)
self.plan_b1 = self._make_plan('b1', self.user_b, True)
self.plan_b2 = self._make_plan('b2', self.user_b, False)
开发者ID:OpenTreeMap,项目名称:otm-core,代码行数:8,代码来源:tests.py
示例19: setUp
def setUp(self):
instance = make_instance()
user = make_admin_user(instance)
species = Species(instance=instance, genus="g1", species="", cultivar="", max_diameter=50.0, max_height=100.0)
species.save_with_user(User.system_user())
login(self.client, user.username)
开发者ID:recklessromeo,项目名称:otm-core,代码行数:8,代码来源:tests.py
示例20: setUp
def setUp(self):
self.point = Point(-8515941.0, 4953519.0)
self.instance = make_instance(point=self.point)
self.user = make_commander_user(self.instance)
self.plot = Plot(geom=self.point, instance=self.instance)
self.plot.save_with_user(self.user)
self.plot = Plot.objects.get(pk=self.plot.pk)
self.initial_updated = self.plot.updated_at
开发者ID:barbaralluz,项目名称:otm-core,代码行数:8,代码来源:test_map_feature.py
注:本文中的treemap.tests.make_instance函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论