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


Python Criteria.get_criteria_dict方法代码示例

本文整理汇总了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')
开发者ID:premanand17,项目名称:django-criteria,代码行数:11,代码来源:test_criteria.py

示例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')
开发者ID:premanand17,项目名称:django-criteria,代码行数:24,代码来源:test_criteria.py


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