Skip to content

Commit

Permalink
Test delimitedtext provider with and without "file://" prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
suricactus committed Jun 16, 2020
1 parent b7d06d3 commit 62861ad
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion tests/src/python/test_qgsdelimitedtextprovider.py
Expand Up @@ -63,7 +63,7 @@
class MyUrl:

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

@classmethod
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 62861ad

Please sign in to comment.