def test_with_string(self): """Assert that a string is validated and converted to unicode.""" result = config._validate_none_or(str)('unicode?') assert result == 'unicode?' assert isinstance(result, str)
def test_with_string(self): """Assert that a string is validated and converted to unicode.""" result = config._validate_none_or(six.text_type)('unicode?') self.assertEqual(result, u'unicode?') self.assertTrue(isinstance(result, six.text_type))
def test_with_none(self): """Assert that None is allowed.""" result = config._validate_none_or(str)(None) assert result is None
def test_with_none(self): """Assert that None is allowed.""" result = config._validate_none_or(six.text_type)(None) self.assertTrue(result is None)