diff options
author | BonfaceKilz | 2021-05-04 22:17:56 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-05-05 12:26:04 +0300 |
commit | 7b8ffda6de6be67736074d707015ed22a55d1185 (patch) | |
tree | 0665b903560ae3175a4daf469bd3900d1c90d9c1 /wqflask/tests/unit/base/test_species.py | |
parent | b329dcdad5323c1d2d715cdac8458b1dae4ac137 (diff) | |
download | genenetwork2-7b8ffda6de6be67736074d707015ed22a55d1185.tar.gz |
tests: test_species: Add test cases for TestTheSpecies class
Diffstat (limited to 'wqflask/tests/unit/base/test_species.py')
-rw-r--r-- | wqflask/tests/unit/base/test_species.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/wqflask/tests/unit/base/test_species.py b/wqflask/tests/unit/base/test_species.py new file mode 100644 index 00000000..950909a1 --- /dev/null +++ b/wqflask/tests/unit/base/test_species.py @@ -0,0 +1,27 @@ +"""Tests wqflask/base/species.py""" + +import unittest +from unittest import mock +from base.species import TheSpecies + + +class TestTheSpecies(unittest.TestCase): + """Tests for TheSpecies class""" + @mock.patch('base.species.Chromosomes') + def test_create_species_with_null_species_name(self, mock_chromosome): + """Test that TheSpecies is instantiated correctly when the +species_name is provided.""" + mock_chromosome.return_value = 1 + test_species = TheSpecies(dataset="random_dataset", species_name="a") + self.assertEqual(test_species.name, "a") + self.assertEqual(test_species.chromosomes, 1) + + @mock.patch('base.species.Chromosomes') + def test_create_species_with_species_name(self, mock_chromosome): + """Test that TheSpecies is instantiated correctly when the +species_name is not provided.""" + mock_chromosome.return_value = 1 + test_species = TheSpecies(dataset="random_dataset") + self.assertEqual(test_species.dataset, "random_dataset") + self.assertEqual(test_species.chromosomes, 1) + mock_chromosome.assert_called_once_with(dataset="random_dataset") |