Ejemplo n.º 1
0
 def test_is_bytes(self):
     """
     Verifies what bytes means, basically that they are the same
     thing across Python 2 and 3 and can be decoded into "text"
     """
     binary = b''
     text = u''
     self.assertTrue(astring.is_bytes(binary))
     self.assertFalse(astring.is_bytes(text))
     self.assertTrue(hasattr(binary, 'decode'))
     self.assertTrue(astring.is_text(binary.decode()))
     self.assertFalse(astring.is_bytes(str('')))
Ejemplo n.º 2
0
 def test_is_bytes(self):
     """
     Verifies what bytes means, basically that they are the same
     thing across Python 2 and 3 and can be decoded into "text"
     """
     binary = b''
     text = u''
     self.assertTrue(astring.is_bytes(binary))
     self.assertFalse(astring.is_bytes(text))
     self.assertTrue(hasattr(binary, 'decode'))
     self.assertTrue(astring.is_text(binary.decode()))
     # on Python 2, each str member is also a single byte char
     if sys.version_info[0] < 3:
         self.assertTrue(astring.is_bytes(str('')))
     else:
         self.assertFalse(astring.is_bytes(str('')))
Ejemplo n.º 3
0
 def test_is_bytes(self):
     """
     Verifies what bytes means, basically that they are the same
     thing across Python 2 and 3 and can be decoded into "text"
     """
     binary = b''
     text = u''
     self.assertTrue(astring.is_bytes(binary))
     self.assertFalse(astring.is_bytes(text))
     self.assertTrue(hasattr(binary, 'decode'))
     self.assertTrue(astring.is_text(binary.decode()))
     # on Python 2, each str member is also a single byte char
     if sys.version_info[0] < 3:
         self.assertTrue(astring.is_bytes(str('')))
     else:
         self.assertFalse(astring.is_bytes(str('')))
Ejemplo n.º 4
0
 def test_is_text(self):
     """
     Verifies what text means, basically that they can represent
     extended set of characters and can be encoded into "bytes"
     """
     binary = b''
     text = u''
     self.assertTrue(astring.is_text(text))
     self.assertFalse(astring.is_text(binary))
     self.assertTrue(hasattr(text, 'encode'))
     self.assertTrue(astring.is_bytes(text.encode()))
Ejemplo n.º 5
0
 def test_is_text(self):
     """
     Verifies what text means, basically that they can represent
     extended set of characters and can be encoded into "bytes"
     """
     binary = b''
     text = u''
     self.assertTrue(astring.is_text(text))
     self.assertFalse(astring.is_text(binary))
     self.assertTrue(hasattr(text, 'encode'))
     self.assertTrue(astring.is_bytes(text.encode()))