Skip to content
Permalink
Browse files

Fix F523 flake issues

  • Loading branch information
nyalldawson committed May 12, 2020
1 parent 04699b0 commit e76013e9cd6a93a5aea90cdc04325633983ef1ba
@@ -23,7 +23,7 @@
try:
data = urlopen(url).read().decode('utf-8')
except URLError as err:
print("URLError: ".format(err.reason))
print("URLError: {}".format(err.reason))
sys.exit(1)

obj = json.loads(data)
@@ -48,8 +48,7 @@ def processInputs(alg, parameters, context, feedback):

# Grab the projected Crs
crs = alg.parameterAsCrs(parameters, 'crs', context)
alg.commands.append('g.proj -c proj4="{}"'.format(
crs.toProj(), newLocation))
alg.commands.append('g.proj -c proj4="{}"'.format(crs.toProj()))

# Remove crs parameter
alg.removeParameter('crs')
@@ -48,8 +48,7 @@ def processInputs(alg, parameters, context, feedback):

# Grab the projected Crs
crs = alg.parameterAsCrs(parameters, 'crs', context)
alg.commands.append('g.proj -c proj4="{}"'.format(
crs.toProj(), newLocation))
alg.commands.append('g.proj -c proj4="{}"'.format(crs.toProj()))

# Remove crs parameter
alg.removeParameter('crs')
@@ -311,7 +311,7 @@ def testSelectSubsetString(self):

testdata_path = unitTestDataPath('provider')
shutil.copy(os.path.join(testdata_path, 'bug_19826.gpkg'), tmpfile)
vl = QgsVectorLayer('{}|layerid=0'.format(tmpfile, 'test', 'ogr'))
vl = QgsVectorLayer('{}|layerid=0'.format(tmpfile), 'test', 'ogr')
vl.setSubsetString("name = 'two'")
got = [feat for feat in vl.getFeatures()]
self.assertEqual(len(got), 1)
@@ -1327,7 +1327,7 @@ def testJson(self):
testdata_path = unitTestDataPath('provider')
shutil.copy(os.path.join(unitTestDataPath('provider'), 'test_json.gpkg'), tmpfile)

vl = QgsVectorLayer('{}|layerid=0'.format(tmpfile, 'foo', 'ogr'))
vl = QgsVectorLayer('{}|layerid=0'.format(tmpfile), 'foo', 'ogr')
self.assertTrue(vl.isValid())

fields = vl.dataProvider().fields()
@@ -513,8 +513,7 @@ def testFromUnitToUnitFactor(self):
res = QgsUnitTypes.fromUnitToUnitFactor(from_unit, QgsUnitTypes.DistanceUnknownUnit)
self.assertAlmostEqual(res,
1.0,
msg='got {:.7f}, expected 1.0 when converting from {} to unknown units'.format(res, expected_factor,
QgsUnitTypes.toString(from_unit)))
msg='got {:.7f}, expected 1.0 when converting from {} to unknown units'.format(res, QgsUnitTypes.toString(from_unit)))

def testAreaFromUnitToUnitFactor(self):
"""Test calculation of conversion factor between areal units"""
@@ -689,8 +688,7 @@ def testAreaFromUnitToUnitFactor(self):
res = QgsUnitTypes.fromUnitToUnitFactor(from_unit, QgsUnitTypes.AreaUnknownUnit)
self.assertAlmostEqual(res,
1.0,
msg='got {:.7f}, expected 1.0 when converting from {} to unknown units'.format(res, expected_factor,
QgsUnitTypes.toString(from_unit)))
msg='got {:.7f}, expected 1.0 when converting from {} to unknown units'.format(res, QgsUnitTypes.toString(from_unit)))

def testDistanceToAreaUnit(self):
"""Test distanceToAreaUnit conversion"""
@@ -1145,8 +1143,7 @@ def testAngleFromUnitToUnitFactor(self):
res = QgsUnitTypes.fromUnitToUnitFactor(from_unit, QgsUnitTypes.AngleUnknownUnit)
self.assertAlmostEqual(res,
1.0,
msg='got {:.7f}, expected 1.0 when converting from {} to unknown units'.format(res, expected_factor,
QgsUnitTypes.toString(from_unit)))
msg='got {:.7f}, expected 1.0 when converting from {} to unknown units'.format(res, QgsUnitTypes.toString(from_unit)))

def testFormatAngle(self):
"""Test formatting angles"""

0 comments on commit e76013e

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