Skip to content

Commit

Permalink
Fix tests and add github tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ademariag committed Aug 17, 2024
1 parent a538165 commit 6cf7f74
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
20 changes: 10 additions & 10 deletions reclass/values/tests/test_compitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, '')
Expand All @@ -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, '')
Expand All @@ -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, '')
Expand All @@ -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, '')
Expand All @@ -69,22 +69,22 @@ 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)
expected = '1'

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):
Expand All @@ -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, '')
Expand All @@ -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, '')
Expand All @@ -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})
Expand Down
6 changes: 3 additions & 3 deletions reclass/values/tests/test_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)


Expand All @@ -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()
2 changes: 1 addition & 1 deletion reclass/values/tests/test_listitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
4 changes: 2 additions & 2 deletions reclass/values/tests/test_parser_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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__':
Expand Down
6 changes: 3 additions & 3 deletions reclass/values/tests/test_refitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -34,15 +34,15 @@ 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):
reference = RefItem('', Settings({'delimiter': ':'}))

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': ':'}))
Expand Down
4 changes: 2 additions & 2 deletions reclass/values/tests/test_scaitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ 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)
scalar2 = ScaItem([2], SETTINGS)

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})
Expand Down
2 changes: 1 addition & 1 deletion reclass/values/tests/test_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6cf7f74

Please sign in to comment.