Skip to content
Permalink
Browse files

Test delimitedtext provider with and without "file://" prefix

  • Loading branch information
suricactus committed Jun 16, 2020
1 parent b7d06d3 commit 62861ad11a9a1e1a5c913e5417387795a7eb1dd7
Showing with 24 additions and 1 deletion.
  1. +24 −1 tests/src/python/test_qgsdelimitedtextprovider.py
@@ -63,7 +63,7 @@
class MyUrl:

def __init__(self, url):
self.url = url
self.url = QUrl(url)
self.query = QUrlQuery()

@classmethod
@@ -129,6 +129,29 @@ def messages(self):
return self.log


class TestQgsDelimitedTextProviderLoading(unittest.TestCase):

def test_open_filepath_with_file_prefix(self):
srcpath = os.path.join(TEST_DATA_DIR, 'provider')
basetestfile = os.path.join(srcpath, 'delimited_xy.csv')

url = MyUrl.fromLocalFile(basetestfile)
url.addQueryItem("type", "csv")

vl = QgsVectorLayer(url.toString(), 'test', 'delimitedtext')
assert vl.isValid(), "{} is invalid".format(basetestfile)

def test_treat_open_filepath_without_file_prefix(self):
srcpath = os.path.join(TEST_DATA_DIR, 'provider')
basetestfile = os.path.join(srcpath, 'delimited_xy.csv')

url = MyUrl(basetestfile)
url.addQueryItem("type", "csv")

vl = QgsVectorLayer(url.toString(), 'test', 'delimitedtext')
assert vl.isValid(), "{} is invalid".format(basetestfile)


class TestQgsDelimitedTextProviderXY(unittest.TestCase, ProviderTestCase):

@classmethod

0 comments on commit 62861ad

Please sign in to comment.
You can’t perform that action at this time.