|
1 | 1 | import os
|
2 | 2 | import re
|
3 | 3 |
|
4 |
| -from fdiff.utils import get_file_modtime, file_exists |
| 4 | +from fdiff.utils import get_file_modtime, get_tables_argument_list, file_exists |
5 | 5 |
|
6 | 6 | import pytest
|
7 | 7 |
|
8 | 8 |
|
| 9 | +def test_file_exists_true(): |
| 10 | + assert file_exists(os.path.join("tests", "testfiles", "test.txt")) is True |
| 11 | + |
| 12 | + |
| 13 | +def test_file_exists_false(): |
| 14 | + assert file_exists(os.path.join("tests", "testfiles", "bogus.jpg")) is False |
| 15 | + |
| 16 | + |
9 | 17 | def test_get_file_modtime():
|
10 | 18 | modtime = get_file_modtime(os.path.join("tests", "testfiles", "test.txt"))
|
11 | 19 | assert modtime.startswith("2019-09-0") is True
|
12 | 20 | regex = re.compile(r"""\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+[-+]\d{2}:\d{2}""")
|
13 | 21 | assert regex.fullmatch(modtime) is not None
|
14 | 22 |
|
15 | 23 |
|
16 |
| -def test_file_exists_true(): |
17 |
| - assert file_exists(os.path.join("tests", "testfiles", "test.txt")) is True |
18 |
| - |
19 |
| - |
20 |
| -def test_file_exists_false(): |
21 |
| - assert file_exists(os.path.join("tests", "testfiles", "bogus.jpg")) is False |
| 24 | +def test_get_tables_argument_list(): |
| 25 | + string1 = "head" |
| 26 | + string2 = "head,post" |
| 27 | + string3 = "head,post,cvt" |
| 28 | + assert get_tables_argument_list(string1) == ["head"] |
| 29 | + assert get_tables_argument_list(string2) == ["head", "post"] |
| 30 | + assert get_tables_argument_list(string3) == ["head", "post", "cvt "] |
0 commit comments