Skip to content
Snippets Groups Projects
Commit 22587cf9 authored by mads's avatar mads
Browse files

fixed utf8 problem

parent cac56aeb
No related branches found
No related tags found
No related merge requests found
......@@ -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'):
......
begin Simulation;
begin Simulation;
time_stop 10 ;
solvertype 1 ; (newmark)
on_no_convergence continue ;
......
......@@ -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']:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment