7
7
from functools import wraps
8
8
9
9
# TODO: could define scts for check_wrappers at the module level
10
- ATTR_SCTS = scts .copy ()
10
+ sct_dict = scts .copy ()
11
11
12
12
13
13
def multi_dec (f ):
@@ -27,16 +27,16 @@ def wrapper(*args, **kwargs):
27
27
return wrapper
28
28
29
29
30
- state_dec = state_dec_gen (State , ATTR_SCTS )
30
+ state_dec = state_dec_gen (State , sct_dict )
31
31
32
32
33
33
class Chain (ProtoChain ):
34
- def __init__ (self , state , attr_scts = ATTR_SCTS ):
34
+ def __init__ (self , state , attr_scts = sct_dict ):
35
35
super ().__init__ (state , attr_scts )
36
36
37
37
38
38
class F (ProtoF ):
39
- def __init__ (self , stack = None , attr_scts = ATTR_SCTS ):
39
+ def __init__ (self , stack = None , attr_scts = sct_dict ):
40
40
super ().__init__ (stack , attr_scts )
41
41
42
42
@@ -49,17 +49,17 @@ def Ex(state=None):
49
49
# decorate functions that may try to run test_* function nodes as subtests
50
50
# so they remove those nodes from the tree
51
51
for k in ["multi" , "with_context" ]:
52
- ATTR_SCTS [k ] = multi_dec (ATTR_SCTS [k ])
52
+ sct_dict [k ] = multi_dec (sct_dict [k ])
53
53
54
54
# allow test_* functions as chained attributes
55
55
for k in TEST_NAMES :
56
- ATTR_SCTS [k ] = Probe (tree = None , f = getattr (test_funcs , k ), eval_on_call = True )
56
+ sct_dict [k ] = Probe (tree = None , f = getattr (test_funcs , k ), eval_on_call = True )
57
57
58
58
# original logical test_* functions behave like multi
59
59
# this is necessary to allow them to take check_* funcs as args
60
60
# since probe behavior will try to call all SCTs passed (assuming they're also probes)
61
61
for k in ["test_or" , "test_correct" ]:
62
- ATTR_SCTS [k ] = multi_dec (getattr (test_funcs , k ))
62
+ sct_dict [k ] = multi_dec (getattr (test_funcs , k ))
63
63
64
64
# Prepare check_funcs to be used alone (e.g. test = check_with().check_body())
65
65
v2_check_functions = {k : state_dec (v ) for k , v in scts .items ()}
0 commit comments