diff options
| author | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-03-29 08:07:15 -0500 |
|---|---|---|
| committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-03-29 08:07:15 -0500 |
| commit | 425f89eee9a84da78a4a113bbdbd12214e6459d9 (patch) | |
| tree | e9f47d29762120d1a1f96fc40db6935e1e76cad4 /tests/unit | |
| parent | 4ea161ff9c2160c4eea5d819f96c449c0edb0c10 (diff) | |
| download | flake8-425f89eee9a84da78a4a113bbdbd12214e6459d9.tar.gz | |
Add more tests around the processor module
Diffstat (limited to 'tests/unit')
| -rw-r--r-- | tests/unit/test_file_processor.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/unit/test_file_processor.py b/tests/unit/test_file_processor.py index 027e74b..50c5fee 100644 --- a/tests/unit/test_file_processor.py +++ b/tests/unit/test_file_processor.py @@ -209,3 +209,43 @@ def test_inside_multiline(): assert file_processor.line_number == 10 assert file_processor.multiline is False + + +@pytest.mark.parametrize('string, expected', [ + ('""', '""'), + ("''", "''"), + ('"a"', '"x"'), + ("'a'", "'x'"), + ('"x"', '"x"'), + ("'x'", "'x'"), + ('"abcdef"', '"xxxxxx"'), + ("'abcdef'", "'xxxxxx'"), + ('""""""', '""""""'), + ("''''''", "''''''"), + ('"""a"""', '"""x"""'), + ("'''a'''", "'''x'''"), + ('"""x"""', '"""x"""'), + ("'''x'''", "'''x'''"), + ('"""abcdef"""', '"""xxxxxx"""'), + ("'''abcdef'''", "'''xxxxxx'''"), + ('"""xxxxxx"""', '"""xxxxxx"""'), + ("'''xxxxxx'''", "'''xxxxxx'''"), +]) +def test_mutate_string(string, expected): + """Verify we appropriately mutate the string to sanitize it.""" + actual = processor.mutate_string(string) + assert expected == actual + + +@pytest.mark.parametrize('string, expected', [ + (' ', 4), + (' ', 6), + ('\t', 8), + ('\t\t', 16), + (' \t', 8), + (' \t', 16), +]) +def test_expand_indent(string, expected): + """Verify we correctly measure the amount of indentation.""" + actual = processor.expand_indent(string) + assert expected == actual |
