def testPIDL(self): # A PIDL of "\1" is: cb pidl cb expect = str2bytes("\03\00" "\1" "\0\0") assert shell.PIDLAsString([str2bytes("\1")]) == expect self._rtPIDL([str2bytes("\0")]) self._rtPIDL([str2bytes("\1"), str2bytes("\2"), str2bytes("\3")]) self._rtPIDL([str2bytes("\0") * 2048] * 2048) # PIDL must be a list with pytest.raises(TypeError): shell.PIDLAsString("foo")
def testPIDL(self): # A PIDL of "\1" is: cb pidl cb expect = str2bytes("\03\00" "\1" "\0\0") self.assertEqual(shell.PIDLAsString([str2bytes("\1")]), expect) self._rtPIDL([str2bytes("\0")]) self._rtPIDL([str2bytes("\1"), str2bytes("\2"), str2bytes("\3")]) self._rtPIDL([str2bytes("\0") * 2048] * 2048) # PIDL must be a list self.assertRaises(TypeError, shell.PIDLAsString, "foo")
def testPIDL(self): # A PIDL of "\1" is: cb pidl cb expect = "\03\00" "\1" "\0\0" self.assertEqual(shell.PIDLAsString(["\1"]), expect) self._rtPIDL(["\0"]) self._rtPIDL(["\1", "\2", "\3"]) self._rtPIDL(["\0" * 2048] * 2048) # PIDL must be a list self.assertRaises(TypeError, shell.PIDLAsString, "foo")
def _rtPIDL(self, pidl): pidl_str = shell.PIDLAsString(pidl) pidl_rt = shell.StringAsPIDL(pidl_str) self.assertEqual(pidl_rt, pidl) pidl_str_rt = shell.PIDLAsString(pidl_rt) self.assertEqual(pidl_str_rt, pidl_str)
def _rtPIDL(self, pidl): pidl_str = shell.PIDLAsString(pidl) pidl_rt = shell.StringAsPIDL(pidl_str) assert pidl_rt == pidl pidl_str_rt = shell.PIDLAsString(pidl_rt) assert pidl_str_rt == pidl_str