Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 17bf8d4

Browse files
committed
Add more informative unit test names. Style cleanup.
1 parent 17e8f9c commit 17bf8d4

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

lib/matplotlib/tests/test_style.py

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -68,51 +68,51 @@ def test_context():
6868
assert mpl.rcParams[PARAM] == 'gray'
6969

7070

71-
def test_context_dict():
72-
ORIGINAL = 'gray'
73-
VALUE_OTHER = 'blue'
74-
mpl.rcParams[PARAM] = ORIGINAL
75-
with style.context({PARAM: VALUE_OTHER}):
76-
assert mpl.rcParams[PARAM] == VALUE_OTHER
77-
assert mpl.rcParams[PARAM] == ORIGINAL
71+
def test_context_with_dict():
72+
original_value = 'gray'
73+
other_value = 'blue'
74+
mpl.rcParams[PARAM] = original_value
75+
with style.context({PARAM: other_value}):
76+
assert mpl.rcParams[PARAM] == other_value
77+
assert mpl.rcParams[PARAM] == original_value
7878

7979

80-
def test_context_dictname1():
80+
def test_context_with_dict_after_namedstyle():
8181
# Test dict after style name where dict modifies the same parameter.
82-
ORIGINAL = 'gray'
83-
VALUE_OTHER = 'blue'
84-
mpl.rcParams[PARAM] = ORIGINAL
82+
original_value = 'gray'
83+
other_value = 'blue'
84+
mpl.rcParams[PARAM] = original_value
8585
with temp_style('test', DUMMY_SETTINGS):
86-
with style.context(['test', {PARAM: VALUE_OTHER}]):
87-
assert mpl.rcParams[PARAM] == VALUE_OTHER
88-
assert mpl.rcParams[PARAM] == ORIGINAL
86+
with style.context(['test', {PARAM: other_value}]):
87+
assert mpl.rcParams[PARAM] == other_value
88+
assert mpl.rcParams[PARAM] == original_value
8989

9090

91-
def test_context_dictname2():
91+
def test_context_with_dict_before_namedstyle():
9292
# Test dict before style name where dict modifies the same parameter.
93-
ORIGINAL = 'gray'
94-
VALUE_OTHER = 'blue'
95-
mpl.rcParams[PARAM] = ORIGINAL
93+
original_value = 'gray'
94+
other_value = 'blue'
95+
mpl.rcParams[PARAM] = original_value
9696
with temp_style('test', DUMMY_SETTINGS):
97-
with style.context([{PARAM: VALUE_OTHER}, 'test']):
97+
with style.context([{PARAM: other_value}, 'test']):
9898
assert mpl.rcParams[PARAM] == VALUE
99-
assert mpl.rcParams[PARAM] == ORIGINAL
99+
assert mpl.rcParams[PARAM] == original_value
100100

101101

102-
def test_context_dictname3():
102+
def test_context_with_union_of_dict_and_namedstyle():
103103
# Test dict after style name where dict modifies the a different parameter.
104-
ORIGINAL = 'gray'
105-
PARAM_OTHER = 'text.usetex'
106-
VALUE_OTHER = True
107-
d = {PARAM_OTHER: VALUE_OTHER}
108-
mpl.rcParams[PARAM] = ORIGINAL
109-
mpl.rcParams[PARAM_OTHER] = (not VALUE_OTHER)
104+
original_value = 'gray'
105+
other_param = 'text.usetex'
106+
other_value = True
107+
d = {other_param: other_value}
108+
mpl.rcParams[PARAM] = original_value
109+
mpl.rcParams[other_param] = (not other_value)
110110
with temp_style('test', DUMMY_SETTINGS):
111111
with style.context(['test', d]):
112112
assert mpl.rcParams[PARAM] == VALUE
113-
assert mpl.rcParams[PARAM_OTHER] == VALUE_OTHER
114-
assert mpl.rcParams[PARAM] == ORIGINAL
115-
assert mpl.rcParams[PARAM_OTHER] == (not VALUE_OTHER)
113+
assert mpl.rcParams[other_param] == other_value
114+
assert mpl.rcParams[PARAM] == original_value
115+
assert mpl.rcParams[other_param] == (not other_value)
116116

117117

118118
if __name__ == '__main__':

0 commit comments

Comments
 (0)