From 186634b8f9039f09b30b24b3714329e17e40f68b Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Thu, 8 May 2014 23:43:58 -0400 Subject: Improved type-casting, parsing, etc --- tests/test.py | 49 +++++++++++++------------------------------------ 1 file changed, 13 insertions(+), 36 deletions(-) (limited to 'tests/test.py') diff --git a/tests/test.py b/tests/test.py index 5be093f..a1a352d 100644 --- a/tests/test.py +++ b/tests/test.py @@ -24,45 +24,11 @@ #SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import os import sexparse -import unittest -DATA = os.path.abspath('data') - -class TestSexConfig(unittest.TestCase): - def setUp(self): - self.default_file = os.path.join(DATA, 'default.sex') - self.new_file = os.path.join(DATA, 'test.sex') - self.config = sexparse.SexConfig(self.default_file) - - def tearDown(self): - if os.path.exists(self.new_file): - os.unlink(self.new_file) - - def test_reading(self): - self.assertIsNone(self.config.read()) - - def test_writing(self): - self.assertIsNone(self.config.write()) -''' - def test_write_new_config(self): - self.config.write(self.default_file) - self.assertTrue(os.path.exists(self.default_file)) +DATA = os.path.abspath('data') - def test_write_new_config_and_read(self): - self.config.write(self.new_file) - self.assertTrue(os.path.exists(self.new_file)) - #config_new = sexparse.SexConfig(self.new_file) - #self.assertEqual(config_new.pairs, self.config.pairs) - - def test_pairs_populated(self): - self.assertIsNotNone(self.config.pairs) -''' - -if __name__ == "__main__": - unittest.main() -''' config = sexparse.SexConfig(os.path.join(DATA, 'default.sex')) param = sexparse.SexParam(os.path.join(DATA, 'default.param')) @@ -71,5 +37,16 @@ param.write(os.path.join(DATA, 'user.param')) param_user = sexparse.SexParam(os.path.join(DATA, 'user.param')) param_user['FLUX_APER'] = 2 param_user.enable('FLUX_APER', True) +param_user['VIGNET'] = [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5] param_user.write() -''' \ No newline at end of file + + +configurations = [ config, param, param_user ] +for obj in configurations: + marks = len(obj.filename) + + print("#" * marks) + print("{}".format(obj.filename)) + print("#" * marks) + + sexparse.sexdump(obj) -- cgit