[Tests] Fix PyQgsDelimitedTextProvider on QT6

This commit is contained in:
Even Rouault 2025-05-17 01:29:32 +02:00
parent b827fd1448
commit 4aaa7050c4
No known key found for this signature in database
GPG Key ID: 33EBBFC47B3DD87D
2 changed files with 35 additions and 33 deletions

View File

@ -264,7 +264,9 @@ class TestQgsDelimitedTextProviderOther(QgisTestCase):
for field in f.fields():
fields.append(str(field.name()))
fieldTypes.append(str(field.typeName()))
fielddata = {name: str(f[name]) for name in fields}
fielddata = {
name: str(f[name]) if f[name] != NULL else "NULL" for name in fields
}
g = f.geometry()
if not g.isNull():
fielddata[geomkey] = str(g.asWkt())

View File

@ -1209,56 +1209,56 @@ def test_027_filter_attributes():
wanted["geometryType"] = 4
wanted["data"] = {
2: {
"id": "None",
"id": "NULL",
"description": "Basic unquoted record",
"data": "None",
"data": "NULL",
"info": "Some info",
"field_5": "None",
"field_5": "NULL",
"#fid": 2,
"#geometry": "None",
},
3: {
"id": "None",
"id": "NULL",
"description": "Quoted field",
"data": "None",
"data": "NULL",
"info": "Unquoted",
"field_5": "None",
"field_5": "NULL",
"#fid": 3,
"#geometry": "None",
},
4: {
"id": "None",
"id": "NULL",
"description": "Escaped quotes",
"data": "None",
"data": "NULL",
"info": "Unquoted",
"field_5": "None",
"field_5": "NULL",
"#fid": 4,
"#geometry": "None",
},
5: {
"id": "None",
"id": "NULL",
"description": "Quoted newlines",
"data": "None",
"data": "NULL",
"info": "No data",
"field_5": "None",
"field_5": "NULL",
"#fid": 5,
"#geometry": "None",
},
9: {
"id": "None",
"id": "NULL",
"description": "Extra fields",
"data": "None",
"data": "NULL",
"info": "info",
"field_5": "None",
"field_5": "NULL",
"#fid": 9,
"#geometry": "None",
},
10: {
"id": "None",
"id": "NULL",
"description": "Missing fields",
"data": "None",
"data": "NULL",
"info": "NULL",
"field_5": "None",
"field_5": "NULL",
"#fid": 10,
"#geometry": "None",
},
@ -1272,38 +1272,38 @@ def test_027_filter_attributes():
"#geometry": "None",
},
2009: {
"id": "None",
"id": "NULL",
"description": "Extra fields",
"data": "None",
"data": "NULL",
"info": "info",
"field_5": "None",
"field_5": "NULL",
"#fid": 9,
"#geometry": "None",
},
3009: {
"id": "None",
"id": "NULL",
"description": "Extra fields",
"data": "None",
"data": "NULL",
"info": "info",
"field_5": "None",
"field_5": "NULL",
"#fid": 9,
"#geometry": "None",
},
4009: {
"id": "None",
"id": "NULL",
"description": "Extra fields",
"data": "None",
"data": "NULL",
"info": "info",
"field_5": "None",
"field_5": "NULL",
"#fid": 9,
"#geometry": "None",
},
5009: {
"id": "None",
"description": "None",
"data": "None",
"info": "None",
"field_5": "None",
"id": "NULL",
"description": "NULL",
"data": "NULL",
"info": "NULL",
"field_5": "NULL",
"#fid": 9,
"#geometry": "None",
},