Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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))
Exemplo n.º 3
0
    def test_with_none(self):
        """Assert that None is allowed."""
        result = config._validate_none_or(str)(None)

        assert result is None
Exemplo n.º 4
0
    def test_with_none(self):
        """Assert that None is allowed."""
        result = config._validate_none_or(six.text_type)(None)

        self.assertTrue(result is None)