def test_mapstring_not_unicode(self): """Test that a non-unicode string causes the map_string method to raise a TypeError. """ with pytest.raises(TypeError): mapper = CharMapper(VALID_MAP) mapper.map_string(b'Hello, world!')
def test_mapstring_none(self): """Test that a None value causes the map_string method to raise a TypeError. """ with pytest.raises(TypeError): mapper = CharMapper(VALID_MAP) mapper.map_string(None)
def test_mapstring_empty_string(self): """Test that an empty string causes the map_string method to return an empty string. """ mapper = CharMapper(VALID_MAP) assert mapper.map_string('') == ''
def test_mapstring_arabic(self): """Test that a map_string properly maps an Arabic unicode string. """ mapper = CharMapper(VALID_MAP) assert mapper.map_string('٠١٢٣٤٥٦٧٨٩') == '012---++++'
def test_mapstring_english(self): """Test that a map_string properly maps an English unicode string. """ mapper = CharMapper(VALID_MAP) assert mapper.map_string('Hello, world!') == 'Hu**o, wor*m!'