Esempio n. 1
0
 def test_binary_constructor(self):
     self.assertEqual(types.Binary(u'hello'), b'hello')
     self.assertEqual(types.Binary(u'\u1f60'), u'\u1f60'.encode('utf-8'))
Esempio n. 2
0
def test_binary_constructor(raw, expected):
    assert types.Binary(raw) == expected
Esempio n. 3
0
def test_invalid_binary_constructor(bad):
    with pytest.raises(TypeError):
        types.Binary(bad)
Esempio n. 4
0
 def test_binary_constructor(self):
     self.assertEqual(types.Binary(u"hello"), b"hello")
     self.assertEqual(types.Binary(u"\u1f60"), u"\u1f60".encode("utf-8"))