VisionScore/win_venv/tests.py

26 lines
778 B
Python
Raw Normal View History

2020-12-21 23:10:17 +01:00
import unittest
from main import *
# test saving file
class savingFileTest(unittest.TestCase):
def test_text_file(self):
print('Testing save_input method \n')
old_file_content = 'testing\n\n\nmore testing'
with open('test.txt', 'w') as file:
file.write(old_file_content)
script_path = os.path.dirname(os.path.realpath(__file__))
test_file_path = script_path + '\\test.txt'
newpath = save_input(test_file_path)
new_file_content = ''
with open(newpath, 'r') as new_file:
for line in new_file:
new_file_content += line
self.assertEqual(old_file_content, new_file_content)
if __name__ == '__main__':
unittest.main()