Skip to content

Commit 0cd4911

Browse files
committed
adds unittest for move to method
1 parent 81468ff commit 0cd4911

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

tests/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+

tests/test_classifier.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# -*- coding: utf-8 -*-
2+
3+
import os
4+
import unittest
5+
6+
from classifier import classifier as clf
7+
8+
9+
class ClassifierTest(unittest.TestCase):
10+
11+
__location = os.path.realpath(
12+
os.path.join(os.getcwd(), os.path.dirname(__file__)))
13+
14+
__tmp_file_name = '.classifier_test'
15+
16+
def test_moveto(self):
17+
os.chdir(self.__location)
18+
tmp_file = open(self.__tmp_file_name, 'w')
19+
20+
parent_dir = os.path.abspath(os.path.join(self.__location, os.pardir))
21+
clf.moveto(self.__tmp_file_name, self.__location, parent_dir)
22+
23+
final_file_path = os.path.join(parent_dir, self.__tmp_file_name)
24+
self.assertTrue(os.path.exists(final_file_path))
25+
os.remove(final_file_path)
26+
27+
if __name__ == '__main__':
28+
unittest.main()

0 commit comments

Comments
 (0)