Your IP : 216.73.216.52
��Yf@ � @ sP d Z d d l Z d d l Z d d l Z e � Z Gd d � d e j � Z d S)zGbytecode_helper - support tools for testing correct bytecode generation� Nc @ s@ e Z d Z d Z d d � Z e d d � Z e d d � Z d S) �BytecodeTestCasez1Custom assertion methods for inspecting bytecode.c C s) t j � } t j | d | �| j � S)N�file)�io�StringIO�dis�getvalue)�self�co�s� r �9/opt/alt/python35/lib64/python3.5/test/bytecode_helper.py�get_disassembly_as_string s z*BytecodeTestCase.get_disassembly_as_stringc C s� xE t j | � D]4 } | j | k r | t k s@ | j | k r | Sq W| j | � } | t k rv d | | f } n d } | | | | f } | j | � d S)z=Returns instr if op is found, otherwise throws AssertionErrorz%s not found in bytecode:
%sz!(%s,%r) not found in bytecode:
%sN)r �get_instructions�opname�_UNSPECIFIED�argvalr
�fail)r �xr r �instr�disassembly�msgr r r �assertInBytecode s z!BytecodeTestCase.assertInBytecodec C s� x� t j | � D]x } | j | k r | j | � } | t k rS d | | f } n( | j | k r{ d } | | | | f } | j | � q Wd S)z$Throws AssertionError if op is foundz%s occurs in bytecode:
%sz(%s,%r) occurs in bytecode:
%sN)r r r r
r r r )r r r r r r r r r r �assertNotInBytecode s z$BytecodeTestCase.assertNotInBytecodeN)�__name__�
__module__�__qualname__�__doc__r
r r r r r r r r s r )r Zunittestr r �objectr ZTestCaser r r r r �<module> s