Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
YoannQDQ authored and nyalldawson committed Apr 17, 2023
1 parent 82fb370 commit 0cd25fb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/src/python/test_qgsdelimitedtextprovider.py
Expand Up @@ -26,6 +26,7 @@
import tempfile
import time
from collections.abc import Callable
from pathlib import Path

import qgis # NOQA

Expand Down Expand Up @@ -1411,6 +1412,16 @@ def test_absolute_relative_uri(self):
self.assertEqual(meta.absoluteToRelativeUri(absolute_uri, context), relative_uri)
self.assertEqual(meta.relativeToAbsoluteUri(relative_uri, context), absolute_uri)

def test_special_characters_in_filepath(self):
with tempfile.TemporaryDirectory() as tmpdir:
for basename in ("test.csv", "t e s t .csv", "tèst.csv", "teẞt.csv", "Ťest.csv"):
filepath = Path(tmpdir) / basename
filepath.write_text("id,name\n1,name1\n2,name2\n")
self.assertTrue(filepath.exists())
uri = f"file:///{filepath}"
vl = QgsVectorLayer(uri, "test", "delimitedtext")
self.assertTrue(vl.isValid())


if __name__ == '__main__':
unittest.main()

0 comments on commit 0cd25fb

Please sign in to comment.