Skip to content

Commit 685aea2

Browse files
ezd1000ezd1000
authored andcommitted
Test for load_source function
1 parent 62ed2ee commit 685aea2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

unit_tests/test_Utils.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,15 @@ def test_toDatetime(self):
304304
self.assertEqual(
305305
datetime.datetime(2010, 1, 1, 23, 59, 59, 999999),
306306
Utils.toDatetime(datetime.date(2010, 1, 1), end=True))
307-
307+
def test_load_source(self):
308+
"""Testing load_source in Utils.py"""
309+
filename = "temp_testfile.py"
310+
with open(filename, "w") as f:
311+
f.write("def hello():\n return 'Hello, world!'\n")
312+
inspect = None
313+
module = Utils.load_source("temp_testfile", filename, inspect)
314+
self.assertEqual(module.hello(), 'Hello, world!')
315+
308316

309317
if __name__ == "__main__":
310318
unittest.main()

0 commit comments

Comments
 (0)