File: //usr/local/lib/python3.7/test/__pycache__/test_dynamic.cpython-37.pyc
B
��g* � @ sF d dl Z d dlZd dlmZmZ G dd� dej�ZedkrBe�� dS )� N)� swap_item� swap_attrc @ s` e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dd� Z
dd� Zdd� Zdd� Z
dS )�RebindBuiltinsTestsz=Test all the ways that we can change/shadow globals/builtins.c G s dS )a� Perform TestCase-specific configuration on a function before testing.
By default, this does nothing. Example usage: spinning a function so
that a JIT will optimize it. Subclasses should override this as needed.
Args:
func: function to configure.
*args: any arguments that should be passed to func, if calling it.
Returns:
Nothing. Work will be performed on func in-place.
N� )�self�func�argsr r �-/usr/local/lib/python3.7/test/test_dynamic.py�configure_func
s
z"RebindBuiltinsTests.configure_funcc C sP dd� }| � |� | �|� d� tt� ddd� �� | �|� d� W d Q R X d S )Nc S s t dddg�S )N� � � )�lenr r r r �foo s z=RebindBuiltinsTests.test_globals_shadow_builtins.<locals>.foor
r c S s dS )N� r )�xr r r �<lambda># � zBRebindBuiltinsTests.test_globals_shadow_builtins.<locals>.<lambda>r )r
�assertEqualr �globals)r r r r r �test_globals_shadow_builtins s
z0RebindBuiltinsTests.test_globals_shadow_builtinsc C sN dd� }| � |� | �|� d� ttddd� �� | �|� d� W d Q R X d S )Nc S s t dddg�S )Nr r r
)r r r r r r ( s z5RebindBuiltinsTests.test_modify_builtins.<locals>.foor
r c S s dS )Nr r )r r r r r - r z:RebindBuiltinsTests.test_modify_builtins.<locals>.<lambda>r )r
r r �builtins)r r r r r �test_modify_builtins&