예제 #1
0
    def test_isunicode_str(self):
        """Test that the default string type in Python 3 is a unicode string
        but not in Python 2.
        """

        # In Python 3 strings are unicode encoded by default.
        if six.PY3:
            assert isunicode('Hello, world!')
        else:
            assert not isunicode('Hello, world!')
예제 #2
0
    def test_isunicode_unicode(self):
        """Test that a unicode literal is a unicode string.
        """

        assert isunicode(u'Hello, world!')
예제 #3
0
    def test_isunicode_str(self):
        """Test that the default string type in Python 3 is a unicode string
        but not in Python 2.
        """

        assert isunicode('Hello, world!')
예제 #4
0
    def test_isunicode_byte(self):
        """Test that an explicit byte string is not a Unicode string.
        """

        assert not isunicode(b'Hello, world!')
예제 #5
0
    def test_isunicode_list(self):
        """Test that a list (a Python object) is not a unicode string.
        """

        assert not isunicode(['hello', 'world'])
예제 #6
0
    def test_isunicode_int(self):
        """Test that int (a primitive type) is not a unicode string.
        """

        assert not isunicode(0)
예제 #7
0
    def test_isunicode_none(self):
        """Test that None is not a unicdoe string.
        """

        assert not isunicode(None)