本文整理汇总了Python中treemap.models.Species.common_name方法的典型用法代码示例。如果您正苦于以下问题:Python Species.common_name方法的具体用法?Python Species.common_name怎么用?Python Species.common_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类treemap.models.Species
的用法示例。
在下文中一共展示了Species.common_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_like_filter
# 需要导入模块: from treemap.models import Species [as 别名]
# 或者: from treemap.models.Species import common_name [as 别名]
def test_like_filter(self):
species = Species(
instance=self.instance,
common_name='this is a test species',
genus='Genus-1',
otm_code='S1')
species.save_with_user(self.commander)
p, t = self.create_tree_and_plot()
t.species = species
t.save_with_user(self.commander)
species_like_filter = json.dumps({
'species.common_name':
{'LIKE': 's a tes'}})
plots = search.Filter(species_like_filter, '', self.instance)\
.get_objects(Plot)
result = [o.pk for o in plots]
self.assertEqual(result, [p.pk])
species.common_name = 'no match'
species.save_with_user(self.commander)
plots = search.Filter(species_like_filter, '', self.instance)\
.get_objects(Plot)
self.assertEqual(len(plots), 0)
示例2: test_like_filter
# 需要导入模块: from treemap.models import Species [as 别名]
# 或者: from treemap.models.Species import common_name [as 别名]
def test_like_filter(self):
species = Species(
instance=self.instance,
common_name='this is a test species',
genus='Genus-1',
otm_code='S1')
species.save_with_user(self.commander)
p, t = self.create_tree_and_plot()
t.species = species
t.save_with_user(self.commander)
species_like_filter = json.dumps({
'species.common_name':
{'LIKE': 's a tes'}})
result = [o.pk for o in
_execute_filter(
self.instance, species_like_filter)]
self.assertEqual(result, [p.pk])
species.common_name = 'no match'
species.save_with_user(self.commander)
result = _execute_filter(
self.instance, species_like_filter)
self.assertEqual(len(result), 0)