diff --git a/wetb/hawc2/htc_file.py b/wetb/hawc2/htc_file.py index e8a7f945fde97242e2ba733a83846457a5f152d3..f6f620901c6b99bc320b2ae97e38fd9d3ef7d431 100644 --- a/wetb/hawc2/htc_file.py +++ b/wetb/hawc2/htc_file.py @@ -51,7 +51,7 @@ class HTCFile(HTCContents, HTCDefaults): def readlines(self, filename): self.htc_inputfiles.append(filename) htc_lines = [] - with open(filename, encoding='utf-8') as fid: + with open(filename) as fid: lines = fid.readlines() for l in lines: if l.lower().lstrip().startswith('continue_in_file'): diff --git a/wetb/hawc2/tests/test_files/htcfiles/continue_in_file.htc b/wetb/hawc2/tests/test_files/htcfiles/continue_in_file.htc index 4391a8dc856eb506094e1bd1a5e83e9fa3b043e9..a4f05b74e1e6a15aa9bbd3f93595bfec448e6bb9 100644 --- a/wetb/hawc2/tests/test_files/htcfiles/continue_in_file.htc +++ b/wetb/hawc2/tests/test_files/htcfiles/continue_in_file.htc @@ -1,4 +1,4 @@ -begin Simulation; +begin Simulation; time_stop 10 ; solvertype 1 ; (newmark) on_no_convergence continue ; diff --git a/wetb/hawc2/tests/test_htc_file.py b/wetb/hawc2/tests/test_htc_file.py index 04eb5953ccc4781499791d5a3a2d1b7581579558..5699a1c488a33d93d818b1acc8d5b41543d97209 100644 --- a/wetb/hawc2/tests/test_htc_file.py +++ b/wetb/hawc2/tests/test_htc_file.py @@ -24,25 +24,25 @@ class TestHtcFile(unittest.TestCase): def check_htc_file(self, f): - with open(f) as fid: - orglines = fid.readlines() - - htcfile = HTCFile(f) - newlines = str(htcfile).split("\n") - htcfile.save(self.testfilepath + 'tmp.htc') - #with open(self.testfilepath + 'tmp.htc') as fid: - # newlines = fid.readlines() - - for i, (org, new) in enumerate(zip(orglines, newlines), 1): - fmt = lambda x : x.strip().replace("\t", " ").replace(" ", " ").replace(" ", " ").replace(" ", " ").replace(" ", " ") - if fmt(org) != fmt(new): - print ("----------%d-------------" % i) - print (fmt(org)) - print (fmt(new)) - self.assertEqual(fmt(org), fmt(new)) - break - print () - assert len(orglines) == len(newlines) + with open(f) as fid: + orglines = fid.readlines() + + htcfile = HTCFile(f) + newlines = str(htcfile).split("\n") + htcfile.save(self.testfilepath + 'tmp.htc') + #with open(self.testfilepath + 'tmp.htc') as fid: + # newlines = fid.readlines() + + for i, (org, new) in enumerate(zip(orglines, newlines), 1): + fmt = lambda x : x.strip().replace("\t", " ").replace(" ", " ").replace(" ", " ").replace(" ", " ").replace(" ", " ") + if fmt(org) != fmt(new): + print ("----------%d-------------" % i) + print (fmt(org)) + print (fmt(new)) + self.assertEqual(fmt(org), fmt(new)) + break + print () + assert len(orglines) == len(newlines) def test_htc_files(self): for f in ['test3.htc']: