diff options
author | Arun Isaac | 2023-12-30 05:17:17 +0000 |
---|---|---|
committer | Arun Isaac | 2023-12-30 05:17:17 +0000 |
commit | 8536431f9c367c55d2ea138ab24b2d12e98f7c81 (patch) | |
tree | 1d7d272066ee675065e4d1e89fa37fdb5293e101 /gn2/tests/unit/base | |
parent | 21d6de22641cb1b540e03cb963d12593dab16046 (diff) | |
download | genenetwork2-8536431f9c367c55d2ea138ab24b2d12e98f7c81.tar.gz |
Namespace mock paths under gn2.
Diffstat (limited to 'gn2/tests/unit/base')
-rw-r--r-- | gn2/tests/unit/base/test_data_set.py | 10 | ||||
-rw-r--r-- | gn2/tests/unit/base/test_species.py | 2 | ||||
-rw-r--r-- | gn2/tests/unit/base/test_trait.py | 38 |
3 files changed, 25 insertions, 25 deletions
diff --git a/gn2/tests/unit/base/test_data_set.py b/gn2/tests/unit/base/test_data_set.py index 7341314c..9f9fb132 100644 --- a/gn2/tests/unit/base/test_data_set.py +++ b/gn2/tests/unit/base/test_data_set.py @@ -173,7 +173,7 @@ class TestDataSetTypes(unittest.TestCase): ("All Phenotypes", redis_mock, cursor_mock), "Publish") redis_mock.get.assert_called_once_with("dataset_structure") - @mock.patch('base.data_set.datasettype.requests.get') + @mock.patch('gn2.base.data_set.datasettype.requests.get') def test_data_set_type_with_empty_redis(self, request_mock): """Test that DatasetType returns correctly if the Redis Instance is empty and the name variable exists in the dictionary @@ -204,8 +204,8 @@ class TestDataSetTypes(unittest.TestCase): class TestDatasetAccessionId(unittest.TestCase): """Tests for the DataSetType class""" - @mock.patch("base.data_set.dataset.query_sql") - @mock.patch("base.data_set.dataset.DatasetGroup") + @mock.patch("gn2.base.data_set.dataset.query_sql") + @mock.patch("gn2.base.data_set.dataset.DatasetGroup") def test_get_accession_id(self, mock_dataset_group, mock_query_sql): def mock_fn(): yield MonadicDict({"accession_id": 7}) @@ -221,8 +221,8 @@ class TestDatasetAccessionId(unittest.TestCase): .accession_id\ .bind(lambda x: self.assertEqual(7, x)) - @mock.patch("base.data_set.dataset.query_sql") - @mock.patch("base.data_set.dataset.DatasetGroup") + @mock.patch("gn2.base.data_set.dataset.query_sql") + @mock.patch("gn2.base.data_set.dataset.DatasetGroup") def test_get_accession_id_empty_return(self, mock_dataset_group, mock_query_sql): mock_dataset_group.return_value = MockGroup() diff --git a/gn2/tests/unit/base/test_species.py b/gn2/tests/unit/base/test_species.py index 239e8b3f..d2845b25 100644 --- a/gn2/tests/unit/base/test_species.py +++ b/gn2/tests/unit/base/test_species.py @@ -30,7 +30,7 @@ class MockDataset: (None, "Random Dataset", None, 1))) def test_species(mocker, species_name, dataset, expected_name, chromosome_param): - _c = mocker.patch("base.species.Chromosomes", + _c = mocker.patch("gn2.base.species.Chromosomes", return_value=chromosome_param) test_species = TheSpecies(dataset=dataset, species_name=species_name) diff --git a/gn2/tests/unit/base/test_trait.py b/gn2/tests/unit/base/test_trait.py index 417956ae..2adb1fdf 100644 --- a/gn2/tests/unit/base/test_trait.py +++ b/gn2/tests/unit/base/test_trait.py @@ -31,7 +31,7 @@ class MockTrait(GeneralTrait): class TestRetrieveTraitInfo(unittest.TestCase): """Tests for 'retrieve_trait_info'""" - @mock.patch('base.trait.database_connection') + @mock.patch('gn2.base.trait.database_connection') def test_retrieve_trait_info_with_empty_dataset(self, mock_db): """Test that an exception is raised when dataset is empty""" conn = mock.MagicMock() @@ -40,9 +40,9 @@ class TestRetrieveTraitInfo(unittest.TestCase): retrieve_trait_info(trait=mock.MagicMock(), dataset={}) - @mock.patch('base.trait.requests.get') - @mock.patch('base.trait.g', mock.Mock()) - @mock.patch('base.trait.database_connection') + @mock.patch('gn2.base.trait.requests.get') + @mock.patch('gn2.base.trait.g', mock.Mock()) + @mock.patch('gn2.base.trait.database_connection') def test_retrieve_trait_info_with_empty_trait_info(self, mock_db, requests_mock): @@ -57,9 +57,9 @@ class TestRetrieveTraitInfo(unittest.TestCase): retrieve_trait_info(trait=mock.MagicMock(), dataset=mock.MagicMock()) - @mock.patch('base.trait.requests.get') - @mock.patch('base.trait.g', mock.Mock()) - @mock.patch('base.trait.database_connection') + @mock.patch('gn2.base.trait.requests.get') + @mock.patch('gn2.base.trait.g', mock.Mock()) + @mock.patch('gn2.base.trait.database_connection') def test_retrieve_trait_info_with_non_empty_trait_info(self, mock_db, requests_mock): @@ -80,9 +80,9 @@ class TestRetrieveTraitInfo(unittest.TestCase): self.assertEqual(test_trait.c, 3) self.assertEqual(test_trait.d, 4) - @mock.patch('base.trait.requests.get') - @mock.patch('base.trait.g', mock.Mock()) - @mock.patch('base.trait.database_connection') + @mock.patch('gn2.base.trait.requests.get') + @mock.patch('gn2.base.trait.g', mock.Mock()) + @mock.patch('gn2.base.trait.database_connection') def test_retrieve_trait_info_utf8_parsing(self, mock_db, requests_mock): @@ -120,9 +120,9 @@ class TestRetrieveTraitInfo(unittest.TestCase): @unittest.skip("Too complicated") - @mock.patch('base.trait.requests.get') - @mock.patch('base.trait.database_connection') - @mock.patch('base.trait.get_resource_id') + @mock.patch('gn2.base.trait.requests.get') + @mock.patch('gn2.base.trait.database_connection') + @mock.patch('gn2.base.trait.get_resource_id') def test_retrieve_trait_info_with_non_empty_lrs(self, resource_id_mock, mock_db, @@ -169,9 +169,9 @@ class TestRetrieveTraitInfo(unittest.TestCase): "2.4") @unittest.skip("Too complicated") - @mock.patch('base.trait.requests.get') - @mock.patch('base.trait.g') - @mock.patch('base.trait.get_resource_id') + @mock.patch('gn2.base.trait.requests.get') + @mock.patch('gn2.base.trait.g') + @mock.patch('gn2.base.trait.get_resource_id') def test_retrieve_trait_info_with_empty_lrs_field(self, resource_id_mock, g_mock, @@ -215,9 +215,9 @@ class TestRetrieveTraitInfo(unittest.TestCase): "Chr2: 3.000000") @unittest.skip("Too complicated") - @mock.patch('base.trait.requests.get') - @mock.patch('base.trait.g') - @mock.patch('base.trait.get_resource_id') + @mock.patch('gn2.base.trait.requests.get') + @mock.patch('gn2.base.trait.g') + @mock.patch('gn2.base.trait.get_resource_id') def test_retrieve_trait_info_with_empty_chr_field(self, resource_id_mock, g_mock, |