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

Skip to content

Commit 995173d

Browse files
author
Alexis Bienvenüe
committed
Rename functions in determinism.py to remove `test' keyword, since these are not main testing functions.
1 parent c56dae7 commit 995173d

3 files changed

Lines changed: 21 additions & 20 deletions

File tree

lib/matplotlib/testing/determinism.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from matplotlib import pyplot as plt
1010

1111

12-
def _test_determinism_save(filename, objects='mhi', format="pdf"):
12+
def _determinism_save(filename, objects='mhi', format="pdf"):
1313
# save current value of SOURCE_DATE_EPOCH and set it
1414
# to a constant value, so that time difference is not
1515
# taken into account
@@ -60,7 +60,7 @@ def _test_determinism_save(filename, objects='mhi', format="pdf"):
6060
os.environ['SOURCE_DATE_EPOCH'] = sde
6161

6262

63-
def _test_determinism(objects='mhi', format="pdf", uid=""):
63+
def _determinism_check(objects='mhi', format="pdf", uid=""):
6464
"""
6565
Output three times the same graphs and checks that the outputs are exactly
6666
the same.
@@ -87,8 +87,8 @@ def _test_determinism(objects='mhi', format="pdf", uid=""):
8787
'import matplotlib; '
8888
'matplotlib.use(%r); '
8989
'from matplotlib.testing.determinism '
90-
'import _test_determinism_save;'
91-
'_test_determinism_save(%r,%r,%r)'
90+
'import _determinism_save;'
91+
'_determinism_save(%r,%r,%r)'
9292
% (format, filename, objects, format)])
9393
with open(filename, 'rb') as fd:
9494
plots.append(fd.read())
@@ -97,7 +97,7 @@ def _test_determinism(objects='mhi', format="pdf", uid=""):
9797
assert_equal(p, plots[0])
9898

9999

100-
def _test_source_date_epoch(format, string, keyword=b"CreationDate"):
100+
def _determinism_source_date_epoch(format, string, keyword=b"CreationDate"):
101101
"""
102102
Test SOURCE_DATE_EPOCH support. Output a document with the envionment
103103
variable SOURCE_DATE_EPOCH set to 2000-01-01 00:00 UTC and check that the
@@ -121,8 +121,8 @@ def _test_source_date_epoch(format, string, keyword=b"CreationDate"):
121121
'import matplotlib; '
122122
'matplotlib.use(%r); '
123123
'from matplotlib.testing.determinism '
124-
'import _test_determinism_save;'
125-
'_test_determinism_save(%r,%r,%r)'
124+
'import _determinism_save;'
125+
'_determinism_save(%r,%r,%r)'
126126
% (format, filename, "", format)])
127127
find_keyword = re.compile(b".*" + keyword + b".*")
128128
with open(filename, 'rb') as fd:

lib/matplotlib/tests/test_backend_pdf.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
from matplotlib import cm, rcParams
1313
from matplotlib.backends.backend_pdf import PdfPages
1414
from matplotlib import pyplot as plt
15-
from matplotlib.testing.determinism import (_test_source_date_epoch,
16-
_test_determinism)
15+
from matplotlib.testing.determinism import (_determinism_source_date_epoch,
16+
_determinism_check)
1717
from matplotlib.testing.decorators import (image_comparison, knownfailureif,
1818
cleanup)
1919

@@ -114,37 +114,37 @@ def test_composite_image():
114114
@cleanup
115115
def test_source_date_epoch():
116116
"""Test SOURCE_DATE_EPOCH support for PDF output"""
117-
_test_source_date_epoch("pdf", b"/CreationDate (D:20000101000000Z)")
117+
_determinism_source_date_epoch("pdf", b"/CreationDate (D:20000101000000Z)")
118118

119119

120120
@cleanup
121121
def test_determinism_plain():
122122
"""Test for reproducible PDF output: simple figure"""
123-
_test_determinism('', format="pdf")
123+
_determinism_check('', format="pdf")
124124

125125

126126
@cleanup
127127
def test_determinism_images():
128128
"""Test for reproducible PDF output: figure with different images"""
129-
_test_determinism('i', format="pdf")
129+
_determinism_check('i', format="pdf")
130130

131131

132132
@cleanup
133133
def test_determinism_hatches():
134134
"""Test for reproducible PDF output: figure with different hatches"""
135-
_test_determinism('h', format="pdf")
135+
_determinism_check('h', format="pdf")
136136

137137

138138
@cleanup
139139
def test_determinism_markers():
140140
"""Test for reproducible PDF output: figure with different markers"""
141-
_test_determinism('m', format="pdf")
141+
_determinism_check('m', format="pdf")
142142

143143

144144
@cleanup
145145
def test_determinism_all():
146146
"""Test for reproducible PDF output"""
147-
_test_determinism(format="pdf")
147+
_determinism_check(format="pdf")
148148

149149

150150
@image_comparison(baseline_images=['hatching_legend'],

lib/matplotlib/tests/test_backend_ps.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import matplotlib
1212
import matplotlib.pyplot as plt
1313
from matplotlib import patheffects
14-
from matplotlib.testing.determinism import (_test_source_date_epoch,
15-
_test_determinism)
14+
from matplotlib.testing.determinism import (_determinism_source_date_epoch,
15+
_determinism_check)
1616
from matplotlib.testing.decorators import cleanup, knownfailureif
1717

1818

@@ -183,13 +183,14 @@ def test_source_date_epoch():
183183
# because the produced timestamp comes from ghostscript:
184184
# %%CreationDate: D:20000101000000Z00\'00\', and this could change
185185
# with another ghostscript version.
186-
_test_source_date_epoch("ps", b"%%CreationDate: Sat Jan 01 00:00:00 2000")
186+
_determinism_source_date_epoch(
187+
"ps", b"%%CreationDate: Sat Jan 01 00:00:00 2000")
187188

188189

189190
@cleanup
190191
def test_determinism_all():
191192
"""Test for reproducible PS output"""
192-
_test_determinism(format="ps")
193+
_determinism_check(format="ps")
193194

194195

195196
@cleanup
@@ -198,7 +199,7 @@ def test_determinism_all():
198199
def test_determinism_all_tex():
199200
"""Test for reproducible PS/tex output"""
200201
matplotlib.rcParams['text.usetex'] = True
201-
_test_determinism(format="ps", uid="_tex")
202+
_determinism_check(format="ps", uid="_tex")
202203

203204

204205
if __name__ == '__main__':

0 commit comments

Comments
 (0)