class MapperTest(unittest.TestCase): """ Tests on the abstract `Mapper` class. """ _VALUES = ["test_value1", "test_value2", "test_value3"] def setUp(self): self._mapper = MockMapper() def test_get_by_property_value_with_value(self): self._mapper.get_by_property_value(Property.NAME, MapperTest._VALUES[0]) self._mapper._get_by_property_value_sequence.assert_called_once_with(Property.NAME, [MapperTest._VALUES[0]]) def test_get_by_property_value_with_list(self): self._mapper.get_by_property_value(Property.NAME, MapperTest._VALUES) self._mapper._get_by_property_value_sequence.assert_called_once_with(Property.NAME, MapperTest._VALUES) def test_get_by_property_value_with_tuple(self): property_value_tuple = (Property.NAME, MapperTest._VALUES[0]) self._mapper.get_by_property_value(property_value_tuple) self._mapper._get_by_property_value_tuple.assert_called_once_with(property_value_tuple) def test_get_by_property_value_with_tuples_list(self): property_value_tuples = [ (Property.NAME, MapperTest._VALUES[0]), (Property.ACCESSION_NUMBER, MapperTest._VALUES[1])] self._mapper.get_by_property_value(property_value_tuples) self._mapper._get_by_property_value_tuple.assert_called_once_with(property_value_tuples)
class MapperTest(unittest.TestCase): """ Tests on the abstract `Mapper` class. """ _VALUES = ["test_value1", "test_value2", "test_value3"] def setUp(self): self._mapper = MockMapper() def test_get_by_property_value_with_value(self): self._mapper.get_by_property_value(Property.NAME, MapperTest._VALUES[0]) self._mapper._get_by_property_value_sequence.assert_called_once_with( Property.NAME, [MapperTest._VALUES[0]]) def test_get_by_property_value_with_list(self): self._mapper.get_by_property_value(Property.NAME, MapperTest._VALUES) self._mapper._get_by_property_value_sequence.assert_called_once_with( Property.NAME, MapperTest._VALUES) def test_get_by_property_value_with_tuple(self): property_value_tuple = (Property.NAME, MapperTest._VALUES[0]) self._mapper.get_by_property_value(property_value_tuple) self._mapper._get_by_property_value_tuple.assert_called_once_with( property_value_tuple) def test_get_by_property_value_with_tuples_list(self): property_value_tuples = [(Property.NAME, MapperTest._VALUES[0]), (Property.ACCESSION_NUMBER, MapperTest._VALUES[1])] self._mapper.get_by_property_value(property_value_tuples) self._mapper._get_by_property_value_tuple.assert_called_once_with( property_value_tuples)
def setUp(self): self._mapper = MockMapper()