def test_sql_value(self): sql = ['this', 'is', 'a', 'sql', 'value'] v = Value(sql, encoding=Encoding.SQL) self.assertEqual(sql, v.get_value()) self.assertEqual(Encoding.SQL, v.encoding)
def test_json_value(self): d = {'this': 'is', 'a': 'json value'} v = Value(d, encoding=Encoding.JSON) self.assertEqual(d, v.get_value()) self.assertEqual(Encoding.JSON, v.encoding)
def test_raw_value_bytes(self): iv = 'test raw value bytes'.encode() v = Value(iv) self.assertEqual(iv, v.get_value()) self.assertEqual(Encoding.RAW, v.encoding)
def test_string_value(self): v = Value('test string value', encoding=Encoding.STRING) self.assertEqual('test string value', v.get_value()) self.assertEqual(Encoding.STRING, v.encoding) self.assertEquals(Encoding.STRING, v.get_encoding())
def test_raw_value_str(self): v = Value('test raw value') self.assertEqual('test raw value'.encode(), v.get_value()) self.assertEqual(Encoding.RAW, v.encoding)