本文整理汇总了Python中qiita_db.metadata_template.prep_template.PrepTemplate.exists方法的典型用法代码示例。如果您正苦于以下问题:Python PrepTemplate.exists方法的具体用法?Python PrepTemplate.exists怎么用?Python PrepTemplate.exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qiita_db.metadata_template.prep_template.PrepTemplate
的用法示例。
在下文中一共展示了PrepTemplate.exists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_post
# 需要导入模块: from qiita_db.metadata_template.prep_template import PrepTemplate [as 别名]
# 或者: from qiita_db.metadata_template.prep_template.PrepTemplate import exists [as 别名]
def test_post(self):
new_prep_id = get_count('qiita.prep_template') + 1
arguments = {'study_id': '1',
'data-type': '16S',
'prep-file': 'new_template.txt'}
response = self.post('/prep_template/', arguments)
self.assertEqual(response.code, 200)
# Check that the new prep template has been created
self.assertTrue(PrepTemplate.exists(new_prep_id))
示例2: _check_prep_template_exists
# 需要导入模块: from qiita_db.metadata_template.prep_template import PrepTemplate [as 别名]
# 或者: from qiita_db.metadata_template.prep_template.PrepTemplate import exists [as 别名]
def _check_prep_template_exists(prep_id):
"""Make sure a prep template exists in the system
Parameters
----------
prep_id : int or str castable to int
PrepTemplate id to check
Returns
-------
dict
{'status': status,
'message': msg}
"""
if not PrepTemplate.exists(int(prep_id)):
return {'status': 'error',
'message': 'Prep template %d does not exist' % int(prep_id)
}
return {'status': 'success',
'message': ''}