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


Python Study.add_pmid方法代码示例

本文整理汇总了Python中qiita_db.study.Study.add_pmid方法的典型用法代码示例。如果您正苦于以下问题:Python Study.add_pmid方法的具体用法?Python Study.add_pmid怎么用?Python Study.add_pmid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qiita_db.study.Study的用法示例。


在下文中一共展示了Study.add_pmid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestStudy

# 需要导入模块: from qiita_db.study import Study [as 别名]
# 或者: from qiita_db.study.Study import add_pmid [as 别名]

#.........这里部分代码省略.........
        exp = ['123456', '7891011']
        self.assertEqual(self.study.pmids, exp)

        new_values = ['654321', '1101987']
        self.study.pmids = new_values
        self.assertEqual(self.study.pmids, new_values)

    def test_pmids_setter_typeerror(self):
        with self.assertRaises(TypeError):
            self.study.pmids = '123456'

    def test_retrieve_investigation(self):
        self.assertEqual(self.study.investigation, 1)

    def test_retrieve_investigation_empty(self):
        new = Study.create(User('[email protected]'), 'NOT Identification of the '
                           'Microbiomes for Cannabis Soils', [1], self.info)
        self.assertEqual(new.investigation, None)

    def test_retrieve_sample_template(self):
        self.assertEqual(self.study.sample_template, 1)

    def test_retrieve_data_types(self):
        self.assertEqual(self.study.data_types, ['18S'])

    def test_retrieve_data_types_none(self):
        new = Study.create(User('[email protected]'), 'NOT Identification of the '
                           'Microbiomes for Cannabis Soils', [1], self.info)
        self.assertEqual(new.data_types, [])

    def test_retrieve_raw_data(self):
        self.assertEqual(self.study.raw_data(), [1])

    def test_retrieve_raw_data_none(self):
        new = Study.create(User('[email protected]'), 'NOT Identification of the '
                           'Microbiomes for Cannabis Soils', [1], self.info)
        self.assertEqual(new.raw_data(), [])

    def test_retrieve_prep_templates(self):
        self.assertEqual(self.study.prep_templates(), [1])

    def test_retrieve_prep_templates_none(self):
        new = Study.create(User('[email protected]'), 'NOT Identification of the '
                           'Microbiomes for Cannabis Soils', [1], self.info)
        self.assertEqual(new.prep_templates(), [])

    def test_retrieve_preprocessed_data(self):
        self.assertEqual(self.study.preprocessed_data(), [1, 2])

    def test_retrieve_preprocessed_data_none(self):
        new = Study.create(User('[email protected]'), 'NOT Identification of the '
                           'Microbiomes for Cannabis Soils', [1], self.info)
        self.assertEqual(new.preprocessed_data(), [])

    def test_retrieve_processed_data(self):
        self.assertEqual(self.study.processed_data(), [1])

    def test_retrieve_processed_data_none(self):
        new = Study.create(User('[email protected]'), 'NOT Identification of the '
                           'Microbiomes for Cannabis Soils', [1], self.info)
        self.assertEqual(new.processed_data(), [])

    def test_add_pmid(self):
        self._change_processed_data_status('sandbox')
        self.study.add_pmid('4544444')
        exp = ['123456', '7891011', '4544444']
        self.assertEqual(self.study.pmids, exp)

    def test_environmental_packages(self):
        obs = self.study.environmental_packages
        exp = ['soil', 'plant-associated']
        self.assertEqual(sorted(obs), sorted(exp))

    def test_environmental_packages_setter(self):
        new = Study.create(User('[email protected]'), 'NOT Identification of the '
                           'Microbiomes for Cannabis Soils', [1], self.info)
        obs = new.environmental_packages
        exp = []
        self.assertEqual(obs, exp)

        new_values = ['air', 'human-oral']
        new.environmental_packages = new_values
        obs = new.environmental_packages
        self.assertEqual(sorted(obs), sorted(new_values))

    def test_environmental_packages_setter_typeerror(self):
        new = Study.create(User('[email protected]'), 'NOT Identification of the '
                           'Microbiomes for Cannabis Soils', [1], self.info)
        with self.assertRaises(TypeError):
            new.environmental_packages = 'air'

    def test_environmental_packages_setter_valueerror(self):
        new = Study.create(User('[email protected]'), 'NOT Identification of the '
                           'Microbiomes for Cannabis Soils', [1], self.info)
        with self.assertRaises(ValueError):
            new.environmental_packages = ['air', 'not a package']

    def test_environmental_packages_sandboxed(self):
        with self.assertRaises(QiitaDBStatusError):
            self.study.environmental_packages = ['air']
开发者ID:MarkBruns,项目名称:qiita,代码行数:104,代码来源:test_study.py

示例2: TestStudy

# 需要导入模块: from qiita_db.study import Study [as 别名]
# 或者: from qiita_db.study.Study import add_pmid [as 别名]

#.........这里部分代码省略.........
        }
        new = Study.create(User('[email protected]'), 'NOT Identification of the '
                           'Microbiomes for Cannabis Soils', [1], self.info)
        self.infoexp.update(newinfo)
        new.info = newinfo
        # add missing table cols
        self.infoexp["funding"] = None
        self.infoexp["spatial_series"] = None
        self.infoexp["most_recent_contact"] = None
        self.infoexp["reprocess"] = False
        self.infoexp["lab_person_id"] = 2
        self.assertEqual(new.info, self.infoexp)

    def test_set_info_public(self):
        """Tests for fail if editing info of a public study"""
        with self.assertRaises(QiitaDBStatusError):
            self.study.info = {"vamps_id": "12321312"}

    def test_set_info_disallowed_keys(self):
        """Tests for fail if sending non-info keys in info dict"""
        new = Study.create(User('[email protected]'), 'NOT Identification of the '
                           'Microbiomes for Cannabis Soils', [1], self.info)
        with self.assertRaises(QiitaDBColumnError):
            new.info = {"email": "[email protected]"}

    def test_info_empty(self):
        new = Study.create(User('[email protected]'), 'NOT Identification of the '
                           'Microbiomes for Cannabis Soils', [1], self.info)
        with self.assertRaises(IncompetentQiitaDeveloperError):
            new.info = {}

    def test_retrieve_status(self):
        self.assertEqual(self.study.status, "public")

    def test_set_status(self):
        new = Study.create(User('[email protected]'), 'NOT Identification of the '
                           'Microbiomes for Cannabis Soils', [1], self.info)
        new.status = "private"
        self.assertEqual(new.status, "private")

    def test_retrieve_shared_with(self):
        self.assertEqual(self.study.shared_with, ['[email protected]',
                         '[email protected]'])

    def test_retrieve_pmids(self):
        exp = ['123456', '7891011']
        self.assertEqual(self.study.pmids, exp)

    def test_retrieve_pmids_empty(self):
        new = Study.create(User('[email protected]'), 'NOT Identification of the '
                           'Microbiomes for Cannabis Soils', [1], self.info)
        self.assertEqual(new.pmids, [])

    def test_retrieve_investigation(self):
        self.assertEqual(self.study.investigation, 1)

    def test_retrieve_investigation_empty(self):
        new = Study.create(User('[email protected]'), 'NOT Identification of the '
                           'Microbiomes for Cannabis Soils', [1], self.info)
        self.assertEqual(new.investigation, None)

    def test_retrieve_sample_template(self):
        self.assertEqual(self.study.sample_template, 1)

    def test_retrieve_data_types(self):
        self.assertEqual(self.study.data_types, ['18S'])

    def test_retrieve_data_types_none(self):
        new = Study.create(User('[email protected]'), 'NOT Identification of the '
                           'Microbiomes for Cannabis Soils', [1], self.info)
        self.assertEqual(new.data_types, [])

    def test_retrieve_raw_data(self):
        self.assertEqual(self.study.raw_data(), [1, 2])

    def test_retrieve_raw_data_none(self):
        new = Study.create(User('[email protected]'), 'NOT Identification of the '
                           'Microbiomes for Cannabis Soils', [1], self.info)
        self.assertEqual(new.raw_data(), [])

    def test_retrieve_preprocessed_data(self):
        self.assertEqual(self.study.preprocessed_data(), [1, 2])

    def test_retrieve_preprocessed_data_none(self):
        new = Study.create(User('[email protected]'), 'NOT Identification of the '
                           'Microbiomes for Cannabis Soils', [1], self.info)
        self.assertEqual(new.preprocessed_data(), [])

    def test_retrieve_processed_data(self):
        self.assertEqual(self.study.processed_data(), [1])

    def test_retrieve_processed_data_none(self):
        new = Study.create(User('[email protected]'), 'NOT Identification of the '
                           'Microbiomes for Cannabis Soils', [1], self.info)
        self.assertEqual(new.processed_data(), [])

    def test_add_pmid(self):
        self.study.add_pmid('4544444')
        exp = ['123456', '7891011', '4544444']
        self.assertEqual(self.study.pmids, exp)
开发者ID:Jorge-C,项目名称:qiita,代码行数:104,代码来源:test_study.py


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