コード例 #1
0
    def test_sql_result(self):
        sr = GenQueryResponseColumn()
        sr.attriInx = 504
        sr.reslen = 64
        sr.value = ["one", "two"]

        expected = "<SqlResult_PI><attriInx>504</attriInx><reslen>64</reslen><value>one</value><value>two</value></SqlResult_PI>"
        self.assertEqual(sr.pack(), expected)

        sr2 = GenQueryResponseColumn()
        sr2.unpack(ET().fromstring(expected))
        self.assertEqual(sr2.attriInx, 504)
        self.assertEqual(sr2.reslen, 64)
        self.assertEqual(sr2.value, ["one", "two"])
        self.assertEqual(sr2.pack(), expected)
コード例 #2
0
    def test_sql_result(self):
        sr = GenQueryResponseColumn()
        sr.attriInx = 504
        sr.reslen = 64
        sr.value = ["one", "two"]

        expected = "<SqlResult_PI><attriInx>504</attriInx><reslen>64</reslen><value>one</value><value>two</value></SqlResult_PI>"
        self.assertEqual(sr.pack(), expected)

        sr2 = GenQueryResponseColumn()
        sr2.unpack(ET.fromstring(expected))
        self.assertEqual(sr2.attriInx, 504)
        self.assertEqual(sr2.reslen, 64)
        self.assertEqual(sr2.value, ["one", "two"])
        self.assertEqual(sr2.pack(), expected)