Skip to content
Permalink
Browse files
Remove deprecated assertEquals use
  • Loading branch information
nyalldawson committed Apr 25, 2017
1 parent 997b630 commit 6b260ffee6d7071ef3009271fb8f3647e6aa4c9b
Showing with 15 additions and 15 deletions.
  1. +3 −3 python/plugins/processing/tests/ParametersTest.py
  2. +6 −6 tests/src/python/test_qgsactionmanager.py
  3. +6 −6 tests/src/python/test_qgsxmlutils.py
@@ -78,8 +78,8 @@ def testScriptCode(self):
if hasattr(param, 'getAsScriptCode'):
code = param.getAsScriptCode()
importedParam = paramClass.fromScriptCode(code)
self.assertEquals(param.optional, importedParam.optional)
self.assertEquals(param.default, importedParam.default, param)
self.assertEqual(param.optional, importedParam.optional)
self.assertEqual(param.default, importedParam.default, param)


class ParameterBooleanTest(unittest.TestCase):
@@ -651,7 +651,7 @@ def testScriptCode(self):
result = getParameterFromString(code)
self.assertIsInstance(result, ParameterExpression)
self.assertTrue(result.optional)
self.assertEquals(result.default, parameter.default)
self.assertEqual(result.default, parameter.default)


class ParameterTableFieldTest(unittest.TestCase):
@@ -141,8 +141,8 @@ def testDefaultAction(self):
# set good default action
self.manager.setDefaultAction('Feature', action1.id())
self.assertTrue(self.manager.defaultAction('Feature').isValid())
self.assertEquals(self.manager.defaultAction('Feature').id(), action1.id())
self.assertNotEquals(self.manager.defaultAction('Feature').id(), action2.id())
self.assertEqual(self.manager.defaultAction('Feature').id(), action1.id())
self.assertNotEqual(self.manager.defaultAction('Feature').id(), action2.id())

# if default action is removed, should be reset to -1
self.manager.clearActions()
@@ -174,26 +174,26 @@ def testDoAction(self):
self.manager.doAction(id1, f, c)
time.sleep(0.5)

self.assertEquals(self.check_action_result(temp_file), 'test output')
self.assertEqual(self.check_action_result(temp_file), 'test output')

# action with substitutions
temp_file = self.get_temp_filename()
id2 = self.manager.addAction(QgsAction.Unix, 'test_action', self.create_action(temp_file, 'test [% $id %] output [% @layer_name %]'))
self.manager.doAction(id2, f, c)
time.sleep(0.5)

self.assertEquals(self.check_action_result(temp_file), 'test 1 output test_layer')
self.assertEqual(self.check_action_result(temp_file), 'test 1 output test_layer')

# test doAction using field variant
temp_file = self.get_temp_filename()
id3 = self.manager.addAction(QgsAction.Unix, 'test_action',
self.create_action(temp_file, 'test : [% @field_index %] : [% @field_name %] : [% @field_value%]'))
self.manager.doActionFeature(id3, f, 0)
time.sleep(0.5)
self.assertEquals(self.check_action_result(temp_file), 'test : 0 : my_field : 5')
self.assertEqual(self.check_action_result(temp_file), 'test : 0 : my_field : 5')
self.manager.doActionFeature(id3, f, 1)
time.sleep(0.5)
self.assertEquals(self.check_action_result(temp_file), 'test : 1 : my_other_field : val')
self.assertEqual(self.check_action_result(temp_file), 'test : 1 : my_other_field : val')


if __name__ == '__main__':
@@ -36,7 +36,7 @@ def test_integer(self):
elem = QgsXmlUtils.writeVariant(my_properties, doc)

prop2 = QgsXmlUtils.readVariant(elem)
self.assertEquals(my_properties, prop2)
self.assertEqual(my_properties, prop2)

def test_string(self):
"""
@@ -49,7 +49,7 @@ def test_string(self):

prop2 = QgsXmlUtils.readVariant(elem)

self.assertEquals(my_properties, prop2)
self.assertEqual(my_properties, prop2)

def test_double(self):
"""
@@ -62,7 +62,7 @@ def test_double(self):

prop2 = QgsXmlUtils.readVariant(elem)

self.assertEquals(my_properties, prop2)
self.assertEqual(my_properties, prop2)

def test_boolean(self):
"""
@@ -75,7 +75,7 @@ def test_boolean(self):

prop2 = QgsXmlUtils.readVariant(elem)

self.assertEquals(my_properties, prop2)
self.assertEqual(my_properties, prop2)

def test_list(self):
"""
@@ -87,7 +87,7 @@ def test_list(self):

prop2 = QgsXmlUtils.readVariant(elem)

self.assertEquals(my_properties, prop2)
self.assertEqual(my_properties, prop2)

def test_complex(self):
"""
@@ -100,7 +100,7 @@ def test_complex(self):

prop2 = QgsXmlUtils.readVariant(elem)

self.assertEquals(my_properties, prop2)
self.assertEqual(my_properties, prop2)


if __name__ == '__main__':

0 comments on commit 6b260ff

Please sign in to comment.