| 1 |
|
| 2 |
""" |
| 3 |
Unit tests for seedir. |
| 4 |
|
| 5 |
Previously written for unittests, and updated for pytest. |
| 6 |
|
| 7 |
Test methods MUST start with "test" |
| 8 |
""" |
| 9 |
|
| 10 |
import os |
| 11 |
|
| 12 |
import seedir as sd |
| 13 |
|
| 14 |
|
| 15 |
testdir = os.path.dirname(os.path.abspath(__file__)) |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
print('\n--------------------' |
| 20 |
'\n\nTesting seedir.seedir() against {}\n\n' |
| 21 |
'--------------------' |
| 22 |
'\n'.format(testdir)) |
| 23 |
|
| 24 |
print('Basic seedir (depthlimit=2, itemlimit=10):\n') |
| 25 |
sd.seedir(testdir, depthlimit=2, itemlimit=10) |
| 26 |
|
| 27 |
print('\nDifferent Styles (depthlimit=1, itemlimit=5):') |
| 28 |
for style in sd.STYLE_DICT.keys(): |
| 29 |
print('\n{}:\n'.format(style)) |
| 30 |
sd.seedir(testdir, style=style, depthlimit=1, itemlimit=5) |
| 31 |
|
| 32 |
print('\nCustom Styles (depthlimit=1, itemlimit=5):') |
| 33 |
sd.seedir(testdir, depthlimit=1, itemlimit=5, space='>>', |
| 34 |
split='>>', extend='II', final='->', |
| 35 |
folderstart='Folder: ', filestart='File: ') |
| 36 |
|
| 37 |
print('\nDifferent Indents (depthlimit=1, itemlimit=5):') |
| 38 |
for i in list(range(3)) + [8]: |
| 39 |
print('\nindent={}:\n'.format(str(i))) |
| 40 |
sd.seedir(testdir, depthlimit=1, itemlimit=5, indent=i) |
| 41 |
|
| 42 |
print('\nItems Beyond Limit (depthlimit=1, itemlimit=1, beyond="content")') |
| 43 |
sd.seedir(testdir, itemlimit=1, beyond='content') |
| 44 |
|
| 45 |
|