Skip to content

Commit 41cc120

Browse files
committed
"all points undefined" produces a warning
And I disable the test, since it doesn't check stderr warnings. yet.
1 parent d7bb591 commit 41cc120

2 files changed

Lines changed: 13 additions & 14 deletions

File tree

demo.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,12 @@ def check_expected_error(what, f):
6969
unset = 'grid',
7070
wait = True)
7171

72-
# This should make an empty plot. It should NOT timeout, which is what it's
73-
# doing now
74-
gp.plot( np.arange(10),
75-
_set = 'xrange [10:20]',
76-
wait = True)
72+
# # This should make no plot at all, with a warning that all the data is out of
73+
# # bounds. I haven't written a test harness to look at stderr output yet, so I
74+
# # disable this check
75+
# gp.plot( np.arange(10),
76+
# _set = 'xrange [10:20]',
77+
# wait = True)
7778

7879
#################################
7980
# some more varied plotting, using the object-oriented interface

gnuplotlib.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,16 +1501,12 @@ def _checkpoint(self, flags=''):
15011501

15021502
fromerr = re.search(r'\s*(.*?)\s*{}$'.format(checkpoint), fromerr, re.M + re.S).group(1)
15031503

1504-
warningre = re.compile(r'^.*(?:warning:\s*(.*?)\s*$)\n?', re.M + re.I)
1504+
warningre = re.compile(r'^\s*(.*?(?:warning|undefined).*?)\s*$', re.M + re.I)
15051505
warnings = warningre.findall(fromerr)
15061506

15071507
if printwarnings:
15081508
for w in warnings:
1509-
sys.stderr.write("Gnuplot warning: {}\n".format(w))
1510-
1511-
1512-
# I've now read all the data up-to the checkpoint. Strip out all the warnings
1513-
fromerr = warningre.sub('',fromerr)
1509+
sys.stderr.write("Gnuplot warns: {}\n".format(w))
15141510

15151511
# if asked, ignore and get rid of all the errors known to happen during
15161512
# plot-command testing. These include
@@ -1534,7 +1530,6 @@ def _checkpoint(self, flags=''):
15341530
re.X + re.M)
15351531
fromerr = r.sub('', fromerr)
15361532

1537-
15381533
# ignore a simple 'invalid range' error observed when, say only the
15391534
# xmin bound is set and all the data is below it
15401535
r = re.compile(r'''^gnuplot>\s*plot.*$ # the test plot command
@@ -1547,13 +1542,13 @@ def _checkpoint(self, flags=''):
15471542
# > xmax (inverted x axis) and when there's out-of-bounds data
15481543
r = re.compile(r'''^gnuplot>\s*plot.*$ # the test plot command
15491544
\n^\s+\^\s*$ # ^ mark pointing to where the error happened
1550-
\n^.*all\s*points.*undefined.*$''', # actual 'invalid range' complaint
1545+
\n^.*all\s*points.*undefined.*$''', # actual 'all points undefined' complaint
15511546
re.X + re.M)
15521547
fromerr = r.sub('', fromerr)
15531548

15541549
# Newer gnuplot sometimes says 'x_min should not equal x_max!' when
15551550
# complaining about ranges. Ignore those here
1556-
r = re.compile(r'^.*_min should not equal .*_max!.*$', # actual 'invalid range' complaint
1551+
r = re.compile(r'^.*_min should not equal .*_max!.*$', # actual 'min != max' complaint
15571552
re.M)
15581553
fromerr = r.sub('', fromerr)
15591554

@@ -1572,6 +1567,9 @@ def _checkpoint(self, flags=''):
15721567
re.X + re.M)
15731568
fromerr = r.sub('', fromerr)
15741569

1570+
# I've now read all the data up-to the checkpoint. Strip out all the warnings
1571+
fromerr = warningre.sub('',fromerr)
1572+
15751573
fromerr = fromerr.strip()
15761574

15771575
return fromerr, warnings

0 commit comments

Comments
 (0)