Skip to content

Commit 7227709

Browse files
committed
Merge pull request #1918 from UV-CDAT/fix_failing_tests_rename
Added missing test file
2 parents ce6f078 + 8ddfda2 commit 7227709

File tree

2 files changed

+59
-3
lines changed

2 files changed

+59
-3
lines changed

testing/vcs/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,10 @@ cdat_add_test(test_vcs_vectors_missing
213213
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_vectors_missing.py
214214
"--source=${BASELINE_DIR}/test_vcs_vectors_missing.png"
215215
)
216-
cdat_add_test(test_remove_marker_none_1d
216+
cdat_add_test(test_vcs_remove_marker_none_1d
217217
"${PYTHON_EXECUTABLE}"
218-
${cdat_SOURCE_DIR}/testing/vcs/test_remove_marker_none_1d.py
219-
"${BASELINE_DIR}/test_remove_marker_none_1d.png"
218+
${cdat_SOURCE_DIR}/testing/vcs/test_vcs_remove_marker_none_1d.py
219+
"${BASELINE_DIR}/test_vcs_remove_marker_none_1d.png"
220220
)
221221
cdat_add_test(test_vcs_png_window_resize
222222
"${PYTHON_EXECUTABLE}"
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
2+
import vcs
3+
import numpy
4+
import cdtime
5+
6+
from vcs_test_common import *
7+
8+
x=vcs.init()
9+
x.drawlogooff()
10+
11+
p=x.createprojection()
12+
assert(p.type == "linear")
13+
assert(vcs.queries.isprojection(p))
14+
15+
test_values_setting(p, "type", [-1,-2,-3,'linear', 'albers equal area', 'lambert', 'mercator', 'polar', 'polyconic', 'equid conic a', 'transverse mercator', 'stereographic', 'lambert azimuthal', 'azimuthal', 'gnomonic', 'orthographic', 'gen. vert. near per', 'sinusoidal', 'equirectangular', 'miller', 'van der grinten', 'hotin', 'robinson', 'space oblique', 'alaska', 'interrupted goode', 'mollweide', 'interrupted mollweide', 'hammer', 'wagner iv', 'wagner vii', 'oblated', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,p,"POLAR","leac"," POlyConic ",],["utm","state plane","foo",-4,31,256,[],{},])
16+
b = x.createprojection("test_b_ok",p.name)
17+
assert(b.name == "test_b_ok")
18+
assert(b.type == "polyconic")
19+
## From vcs validation
20+
for t in range(31):
21+
good = []
22+
bad =[]
23+
pos = []
24+
for param,val in vcs.VCS_validation_functions.proj_ok_parameters.iteritems():
25+
if t in val[0]:
26+
good.append(param)
27+
pos.append(val[1])
28+
else:
29+
bad.append(param)
30+
b.type=t
31+
b._parameters = [1e+20, 1e+20, 1e+20, 1e+20, 1e+20, 1e+20, 1e+20, 1e+20, 1e+20, 1e+20, 1e+20, 1e+20, 1e+20, 1e+20, 1e+20]
32+
for i,att in enumerate(good):
33+
if (att in ['azimuthalangle','azimuthallongitude','satellite','path',] and (b.parameters[12]==0. or b.parameters[12]==1.e20)) \
34+
or \
35+
( att=='standardparallel' and b.parameters[8]==1) \
36+
or \
37+
( att in ['standardparallel1','standardparallel2'] and (b.parameters[8]==0 or b.parameters[8]==1.e20) and t==8)\
38+
:
39+
continue
40+
test_values_setting(b,att,[0.,])
41+
if b.type == "equid conic" and att=="subtype":
42+
ipos = 8
43+
else:
44+
ipos = pos[i]
45+
assert(b.parameters[ipos]==0.)
46+
for att in bad:
47+
try:
48+
setattr(b,att,[],[0.,])
49+
success = True
50+
except:
51+
success = False
52+
else:
53+
if success:
54+
raise ValueError, "Shouldn't have been able to set '%s' on projection of type %s" % (att,b.type)
55+
56+

0 commit comments

Comments
 (0)