-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsplitFile-test.py
executable file
·42 lines (34 loc) · 1.03 KB
/
splitFile-test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/python3 -W all
"""
splitFile-test.py: tests for splitFile.py
usage: splitFile-test.py
20171124 erikt(at)xs4all.nl
"""
import io
import re
import sys
import unittest
from contextlib import redirect_stdout
import splitFile
DATA = ['a','b','c']
OPTSSHORT = ['PROGRAMCALL','-f','DATAFILE']
OPTSLONG = OPTSSHORT+['-n',splitFile.DEFAULTN-1]
def string2list(inString):
outList = inString.split("\n")
if re.search("\n$",inString): outList.pop()
return(outList)
def list2string(inList):
outString = "\n".join(inList)
if len(outString) > 0: outString+"\n"
return(outString)
class myTest(unittest.TestCase):
def testProcessOpts(self):
inFileName,n = splitFile.processOpts(OPTSSHORT)
self.assertEqual(inFileName,OPTSSHORT[-1])
self.assertEqual(n,splitFile.DEFAULTN)
inFileName,n = splitFile.processOpts(OPTSLONG)
self.assertEqual(n,OPTSLONG[-1])
def testReadData(self): pass
def testWriteData(self): pass
if __name__ == '__main__':
unittest.main()