예제 #1
0
    def test_decode_pyc_37(self):

        self.assertTrue(os.path.exists(self.pyc37))
        ret_val = pycdecode(self.pyc37)
        self.assertEqual(len(ret_val), 4)
        self.assertEqual(ret_val[0], 3394)
        self.assertEqual(ret_val[2], 89)
        self.assertIsInstance(ret_val[3], CodeType)
예제 #2
0
    def test_unpack(self):
        _, _, _, code_object = pycdecode(self.pyc37)

        instructions = dis.DecodeCodeObject(
            code_object,
            last_instruction=None,
            python_version=code_object.python_version,
            file='').unpack_code()

        self.assertEqual(len(instructions), 17)
예제 #3
0
    def test_show_code(self):
        _, _, _, code_object = pycdecode(self.pyc37)

        formatted_code = dis.code_info(code_object)

        self.assertIsInstance(formatted_code, str)