Skip to content

Commit

Permalink
finally finished argparse unit tests - this fixes renci-unc#22
Browse files Browse the repository at this point in the history
  • Loading branch information
lstillwe committed May 6, 2015
1 parent 6b39f10 commit c0f9690
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions ugrid2shp/tests/test_parse_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,39 @@ def test_numlevels_arg(self):
test_numlevels,
"Option --numlevels did not set "
"number of contour levels.")

def test_l_arg(self):
test_axislimits = {"10", "20", "30", "40"}
args = vars(ugrid2shp.parse_args(("-l %s"
% " ".join(test_axislimits))
.split()))
self.assertSetEqual(set(args['axis_limits']),
test_axislimits,
"Option -l did not set axis limits.")

def test_axislimits_arg(self):
test_axislimits = {"40", "30", "20", "10"}
args = vars(ugrid2shp.parse_args(("--axislimits %s"
% " ".join(test_axislimits))
.split()))
self.assertSetEqual(set(args['axis_limits']),
test_axislimits,
"Option --axislimits did not set axis limits.")

# need to figure out how to do these final 2 tests with
# a multi word projection string
def test_p_arg(self):
test_projection = "a_projection"
args = vars(ugrid2shp.parse_args(("-p %s"
% (test_projection)).split()))
self.assertEqual(args['ProjStr'],
test_projection,
"Option -p did not set projection string")

def test_proj_arg(self):
test_projection = "other_projection"
args = vars(ugrid2shp.parse_args(("--proj %s"
% (test_projection)).split()))
self.assertEqual(args['ProjStr'],
test_projection,
"Option --proj did not set projection string")

0 comments on commit c0f9690

Please sign in to comment.