From f813bc24157372ff974ec4c6144711b626b79878 Mon Sep 17 00:00:00 2001 From: Tarcisio Fedrizzi Date: Tue, 12 Jan 2016 11:27:11 +0100 Subject: [PATCH] Adds unit test to check that paths ending with newlines are handled correctly --- tests/unit/utils/test_urlutils.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/unit/utils/test_urlutils.py b/tests/unit/utils/test_urlutils.py index 6ee82a586..99e61a832 100644 --- a/tests/unit/utils/test_urlutils.py +++ b/tests/unit/utils/test_urlutils.py @@ -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):