1 | import os |
||
2 | import unittest |
||
3 | from looptools import Timer |
||
4 | from dirutility import TextDump |
||
5 | |||
6 | |||
7 | View Code Duplication | class TestTextDumpWrite(unittest.TestCase): |
|
0 ignored issues
–
show
Duplication
introduced
by
![]() |
|||
8 | |||
9 | @classmethod |
||
10 | def setUpClass(cls): |
||
11 | cls.data = 'dev.hpadesign.com beta.hpadesign.com dev.projects.hpadesign.com projects.hpadesign.com' |
||
12 | cls.data += 'beta.projects.hpadesign.com staging.projects.hpadesign.com staging.hpadesign.com' |
||
13 | cls.data = cls.data.split(' ') |
||
14 | |||
15 | for f in os.listdir(os.path.dirname(__file__)): |
||
16 | if f.startswith('test_dump') and f.endswith('.txt'): |
||
17 | print('Removing: `{0}`'.format(f)) |
||
18 | os.remove(f) |
||
19 | |||
20 | @Timer.decorator_noprint |
||
21 | def test_dump_write(self): |
||
22 | TextDump('test_dump_write.txt').write(self.data) |
||
23 | |||
24 | @Timer.decorator_noprint |
||
25 | def test_dump_append(self): |
||
26 | td = TextDump('test_dump_append.txt') |
||
27 | td.write(self.data) |
||
28 | td.append(list(map(lambda x: '2: ' + x, self.data))) |
||
29 | |||
30 | |||
31 | if __name__ == '__main__': |
||
32 | unittest.main() |
||
33 |