本文整理汇总了Python中criteria.helper.criteria.Criteria.get_criteria_dict方法的典型用法代码示例。如果您正苦于以下问题:Python Criteria.get_criteria_dict方法的具体用法?Python Criteria.get_criteria_dict怎么用?Python Criteria.get_criteria_dict使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类criteria.helper.criteria.Criteria
的用法示例。
在下文中一共展示了Criteria.get_criteria_dict方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_criteria_dict
# 需要导入模块: from criteria.helper.criteria import Criteria [as 别名]
# 或者: from criteria.helper.criteria.Criteria import get_criteria_dict [as 别名]
def test_get_criteria_dict(self):
expected_dict = {'fid': 'GDXHsS00004', 'fname': 'Barrett'}
criteria_dict = Criteria.get_criteria_dict('GDXHsS00004', 'Barrett')
self.assertEqual(expected_dict, criteria_dict, 'dicts are equal')
expected_dict = {'fid': 'GDXHsS00004', 'fnotes': {'rsq': '0.1'}, 'fname': 'Barrett'}
criteria_dict = Criteria.get_criteria_dict('GDXHsS00004', 'Barrett', {'rsq': '0.1'})
self.assertEqual(expected_dict, criteria_dict, 'dicts are equal')
示例2: test_get_criteria_disease_dict
# 需要导入模块: from criteria.helper.criteria import Criteria [as 别名]
# 或者: from criteria.helper.criteria.Criteria import get_criteria_dict [as 别名]
def test_get_criteria_disease_dict(self):
criteria_dict = Criteria.get_criteria_dict('GDXHsS00004', 'Barrett')
diseases = ['T1D']
criteria_disease_dict = Criteria.get_criteria_disease_dict(diseases, criteria_dict, {})
expected_dict = {'T1D': [{'fname': 'Barrett', 'fid': 'GDXHsS00004'}]}
self.assertEqual(criteria_disease_dict, expected_dict, 'Dict as expected')
criteria_disease_dict = Criteria.get_criteria_disease_dict(diseases, criteria_dict, criteria_disease_dict)
self.assertEqual(criteria_disease_dict, expected_dict, 'Dict as expected after addding duplicate')
criteria_dict = Criteria.get_criteria_dict('GDXHsS00005', 'Catfield')
expected_dict = {'T1D': [{'fname': 'Barrett', 'fid': 'GDXHsS00004'},
{'fname': 'Catfield', 'fid': 'GDXHsS00005'}]}
criteria_disease_dict = Criteria.get_criteria_disease_dict(diseases, criteria_dict, criteria_disease_dict)
self.assertEqual(criteria_disease_dict, expected_dict, 'Dict as expected after adding new')
diseases = ['T1D', 'MS']
criteria_disease_dict = Criteria.get_criteria_disease_dict(diseases, criteria_dict, criteria_disease_dict)
expected_dict = {'MS': [{'fname': 'Catfield', 'fid': 'GDXHsS00005'}],
'T1D': [{'fname': 'Barrett', 'fid': 'GDXHsS00004'},
{'fname': 'Catfield', 'fid': 'GDXHsS00005'}]}
self.assertEqual(criteria_disease_dict, expected_dict, 'Dict as expected after adding diseases')