Commit c9fd2a4fd4d4250eca3d74ee89ae47b866b786f8

Authored by Jürgen Knödlseder
1 parent cf1800f7

Add GPars bad filename constructor test.

Showing 1 changed file with 20 additions and 1 deletions
test/test_GApplication.py
... ... @@ -20,7 +20,7 @@
20 20 from gammalib import *
21 21 from math import *
22 22 import os
23   -
  23 +import sys
24 24  
25 25 # ========================================== #
26 26 # Test class for GammaLib application module #
... ... @@ -54,6 +54,7 @@ class Test(GPythonTestSuite):
54 54  
55 55 # Append tests
56 56 self.append(self.test_log, "Test GLog")
  57 + self.append(self.test_pars, "Test GPars")
57 58  
58 59 # Return
59 60 return
... ... @@ -152,3 +153,21 @@ class Test(GPythonTestSuite):
152 153  
153 154 # Return
154 155 return
  156 +
  157 + # Test GPars
  158 + def test_pars(self):
  159 + """
  160 + Test GPars.
  161 + """
  162 + # Test GPars constructor with bad filename.
  163 + self.test_try("Test GPars constructor with bad filename")
  164 + try:
  165 + pars = GPars("testme.par")
  166 + self.test_try_failure("Exception not thrown.")
  167 + except:
  168 + self.test_try_success()
  169 + else:
  170 + self.test_try_failure("This should never happen.")
  171 +
  172 + # Return
  173 + return
... ...