Skip to content
Snippets Groups Projects
Commit 3b1c209c authored by Mads M. Pedersen's avatar Mads M. Pedersen
Browse files

fast_io encoding fix

parent 8b13f0ce
No related branches found
No related tags found
No related merge requests found
......@@ -38,7 +38,7 @@ def load_output(filename):
"""
assert os.path.isfile(filename), "File, %s, does not exists" % filename
with open(filename, 'r', encoding='utf-8') as f:
with open(filename, 'r') as f:
try:
f.readline()
except UnicodeDecodeError:
......@@ -46,7 +46,7 @@ def load_output(filename):
return load_ascii_output(filename)
def load_ascii_output(filename):
with open(filename, encoding='utf-8') as f:
with open(filename) as f:
info = {}
info['name'] = os.path.splitext(os.path.basename(filename))[0]
try:
......
......@@ -35,6 +35,13 @@ class TestFastIO(unittest.TestCase):
self.assertEqual(info['attribute_units'][7], 'deg/s^2')
self.assertAlmostEqual(data[10, 4], 138.822277739535)
def test_load_output2(self):
data, info = load_output(testfilepath + 'DTU10MW2.out')
self.assertEqual(info['name'], "DTU10MW2")
self.assertEqual(info['attribute_names'][-1], "RotPwr")
self.assertEqual(info['attribute_units'][-1], "kW")
if __name__ == "__main__":
#import sys;sys.argv = ['', 'Test.testload_output']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment