Adds unit test to check that paths ending with newlines are handled

correctly
This commit is contained in:
Tarcisio Fedrizzi 2016-01-12 11:27:11 +01:00
parent 5917bbbe5c
commit f813bc2415

View File

@ -166,13 +166,17 @@ class TestFuzzyUrl:
assert not os_mock.path.exists.called
assert url == QUrl('http://foo')
def test_file_absolute(self, os_mock):
@pytest.mark.parametrize('path, expected', [
('/foo', QUrl('file:///foo')),
('/bar\n', QUrl('file:///bar')),
])
def test_file_absolute(self, path, expected, os_mock):
"""Test with an absolute path."""
os_mock.path.exists.return_value = True
os_mock.path.isabs.return_value = True
url = urlutils.fuzzy_url('/foo')
assert url == QUrl('file:///foo')
url = urlutils.fuzzy_url(path)
assert url == expected
@pytest.mark.posix
def test_file_absolute_expanded(self, os_mock):