From 6cf7f74256fa21ff806095d09e00f558a43d43cd Mon Sep 17 00:00:00 2001 From: Alessandro De Maria Date: Sat, 17 Aug 2024 16:32:45 +0000 Subject: [PATCH] Fix tests and add github tests --- reclass/values/tests/test_compitem.py | 20 +++++++++---------- reclass/values/tests/test_item.py | 6 +++--- reclass/values/tests/test_listitem.py | 2 +- reclass/values/tests/test_parser_functions.py | 4 ++-- reclass/values/tests/test_refitem.py | 6 +++--- reclass/values/tests/test_scaitem.py | 4 ++-- reclass/values/tests/test_value.py | 2 +- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/reclass/values/tests/test_compitem.py b/reclass/values/tests/test_compitem.py index c3ee6909..0c1b79a6 100644 --- a/reclass/values/tests/test_compitem.py +++ b/reclass/values/tests/test_compitem.py @@ -30,7 +30,7 @@ def test_assembleRefs_one_item_with_one_ref(self): composite = CompItem([val1], SETTINGS) self.assertTrue(composite.has_references) - self.assertEquals(composite.get_references(), expected_refs) + self.assertEqual(composite.get_references(), expected_refs) def test_assembleRefs_one_item_with_two_refs(self): val1 = Value('${foo}${bar}', SETTINGS, '') @@ -39,7 +39,7 @@ def test_assembleRefs_one_item_with_two_refs(self): composite = CompItem([val1], SETTINGS) self.assertTrue(composite.has_references) - self.assertEquals(composite.get_references(), expected_refs) + self.assertEqual(composite.get_references(), expected_refs) def test_assembleRefs_two_items_one_with_one_ref_one_without(self): val1 = Value('${foo}bar', SETTINGS, '') @@ -49,7 +49,7 @@ def test_assembleRefs_two_items_one_with_one_ref_one_without(self): composite = CompItem([val1, val2], SETTINGS) self.assertTrue(composite.has_references) - self.assertEquals(composite.get_references(), expected_refs) + self.assertEqual(composite.get_references(), expected_refs) def test_assembleRefs_two_items_both_with_one_ref(self): val1 = Value('${foo}', SETTINGS, '') @@ -59,7 +59,7 @@ def test_assembleRefs_two_items_both_with_one_ref(self): composite = CompItem([val1, val2], SETTINGS) self.assertTrue(composite.has_references) - self.assertEquals(composite.get_references(), expected_refs) + self.assertEqual(composite.get_references(), expected_refs) def test_assembleRefs_two_items_with_two_refs(self): val1 = Value('${foo}${baz}', SETTINGS, '') @@ -69,7 +69,7 @@ def test_assembleRefs_two_items_with_two_refs(self): composite = CompItem([val1, val2], SETTINGS) self.assertTrue(composite.has_references) - self.assertEquals(composite.get_references(), expected_refs) + self.assertEqual(composite.get_references(), expected_refs) def test_string_representation(self): composite = CompItem(Value(1, SETTINGS, ''), SETTINGS) @@ -77,14 +77,14 @@ def test_string_representation(self): result = str(composite) - self.assertEquals(result, expected) + self.assertEqual(result, expected) def test_render_single_item(self): val1 = Value('${foo}', SETTINGS, '') composite = CompItem([val1], SETTINGS) - self.assertEquals(1, composite.render({'foo': 1}, None)) + self.assertEqual(1, composite.render({'foo': 1}, None)) def test_render_multiple_items(self): @@ -93,7 +93,7 @@ def test_render_multiple_items(self): composite = CompItem([val1, val2], SETTINGS) - self.assertEquals('12', composite.render({'foo': 1, 'bar': 2}, None)) + self.assertEqual('12', composite.render({'foo': 1, 'bar': 2}, None)) def test_merge_over_merge_scalar(self): val1 = Value(None, SETTINGS, '') @@ -102,7 +102,7 @@ def test_merge_over_merge_scalar(self): result = composite.merge_over(scalar) - self.assertEquals(result, composite) + self.assertEqual(result, composite) def test_merge_over_merge_composite(self): val1 = Value(None, SETTINGS, '') @@ -112,7 +112,7 @@ def test_merge_over_merge_composite(self): result = composite2.merge_over(composite1) - self.assertEquals(result, composite2) + self.assertEqual(result, composite2) def test_merge_other_types_not_allowed(self): other = type('Other', (object,), {'type': 34}) diff --git a/reclass/values/tests/test_item.py b/reclass/values/tests/test_item.py index 4b91f6e6..00b11d5a 100644 --- a/reclass/values/tests/test_item.py +++ b/reclass/values/tests/test_item.py @@ -22,7 +22,7 @@ def test_assembleRef_allrefs(self): iwr = ItemWithReferences([phonyitem], {}) - self.assertEquals(iwr.get_references(), [1]) + self.assertEqual(iwr.get_references(), [1]) self.assertTrue(iwr.allRefs) def test_assembleRef_partial(self): @@ -33,7 +33,7 @@ def test_assembleRef_partial(self): iwr = ItemWithReferences([phonyitem], {}) - self.assertEquals(iwr.get_references(), [1]) + self.assertEqual(iwr.get_references(), [1]) self.assertFalse(iwr.allRefs) @@ -42,7 +42,7 @@ class TestContainerItem(unittest.TestCase): def test_render(self): container = ContainerItem('foo', SETTINGS) - self.assertEquals(container.render(None, None), 'foo') + self.assertEqual(container.render(None, None), 'foo') if __name__ == '__main__': unittest.main() diff --git a/reclass/values/tests/test_listitem.py b/reclass/values/tests/test_listitem.py index 618b7797..009f384c 100644 --- a/reclass/values/tests/test_listitem.py +++ b/reclass/values/tests/test_listitem.py @@ -18,7 +18,7 @@ def test_merge_over_merge_list(self): result = listitem2.merge_over(listitem1) - self.assertEquals(result.contents, expected.contents) + self.assertEqual(result.contents, expected.contents) def test_merge_other_types_not_allowed(self): other = type('Other', (object,), {'type': 34}) diff --git a/reclass/values/tests/test_parser_functions.py b/reclass/values/tests/test_parser_functions.py index a660c76c..1b5e01f9 100644 --- a/reclass/values/tests/test_parser_functions.py +++ b/reclass/values/tests/test_parser_functions.py @@ -94,7 +94,7 @@ def test_standard_reference_parser(self, data): result = pf.listify(parser.parseString(instring).asList()) - self.assertEquals(expected, result) + self.assertEqual(expected, result) @ddt.ddt @@ -109,7 +109,7 @@ def test_standard_reference_parser(self, data): result = pf.listify(parser.parseString(instring).asList()) - self.assertEquals(expected, result) + self.assertEqual(expected, result) if __name__ == '__main__': diff --git a/reclass/values/tests/test_refitem.py b/reclass/values/tests/test_refitem.py index 65814782..02bd9f51 100644 --- a/reclass/values/tests/test_refitem.py +++ b/reclass/values/tests/test_refitem.py @@ -23,7 +23,7 @@ def test_assembleRefs_ok(self): iwr = RefItem([phonyitem], {}) - self.assertEquals(iwr.get_references(), ['foo', 'bar']) + self.assertEqual(iwr.get_references(), ['foo', 'bar']) self.assertTrue(iwr.allRefs) def test_assembleRefs_failedrefs(self): @@ -34,7 +34,7 @@ def test_assembleRefs_failedrefs(self): iwr = RefItem([phonyitem], {}) - self.assertEquals(iwr.get_references(), ['foo']) + self.assertEqual(iwr.get_references(), ['foo']) self.assertFalse(iwr.allRefs) def test__resolve_ok(self): @@ -42,7 +42,7 @@ def test__resolve_ok(self): result = reference._resolve('foo:bar', {'foo':{'bar': 1}}) - self.assertEquals(result, 1) + self.assertEqual(result, 1) def test__resolve_fails(self): refitem = RefItem('', Settings({'delimiter': ':'})) diff --git a/reclass/values/tests/test_scaitem.py b/reclass/values/tests/test_scaitem.py index b6d038de..6cf5032d 100644 --- a/reclass/values/tests/test_scaitem.py +++ b/reclass/values/tests/test_scaitem.py @@ -17,7 +17,7 @@ def test_merge_over_merge_scalar(self): result = scalar2.merge_over(scalar1) - self.assertEquals(result.contents, scalar2.contents) + self.assertEqual(result.contents, scalar2.contents) def test_merge_over_merge_composite(self): scalar1 = CompItem(Value(1, SETTINGS, ''), SETTINGS) @@ -25,7 +25,7 @@ def test_merge_over_merge_composite(self): result = scalar2.merge_over(scalar1) - self.assertEquals(result.contents, scalar2.contents) + self.assertEqual(result.contents, scalar2.contents) def test_merge_other_types_not_allowed(self): other = type('Other', (object,), {'type': 34}) diff --git a/reclass/values/tests/test_value.py b/reclass/values/tests/test_value.py index a06d2207..4c9d8eea 100644 --- a/reclass/values/tests/test_value.py +++ b/reclass/values/tests/test_value.py @@ -41,7 +41,7 @@ def test_simple_string(self): s = 'my cat likes to hide in boxes' tv = Value(s, SETTINGS, '') self.assertFalse(tv.has_references) - self.assertEquals(tv.render(CONTEXT, None), s) + self.assertEqual(tv.render(CONTEXT, None), s) def _test_solo_ref(self, key): s = _var(key)