Skip to content

Commit

Permalink
Removed deprecated assertEquals in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrieleMessina committed Apr 12, 2024
1 parent 4c0bc0b commit 6653086
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
10 changes: 4 additions & 6 deletions src/tests/test_grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ def test_classic_type_declaration_succeed(self):
"""
result = self.parse_qutes_code(code)
actual_value_of_var = result.variables_handler.get_variable_symbol(var_name, self.TOKEN_AST_INDEX_FOR_TESTS).value
self.assertEquals(actual_value_of_var, expected_value_of_var, f"Expected value: {expected_value_of_var}, actual value: {actual_value_of_var}")
self.assertEqual(actual_value_of_var, expected_value_of_var, f"Expected value: {expected_value_of_var}, actual value: {actual_value_of_var}")


def test_classic_type_declaration_throws(self):
params = [
("bool", "10"),
Expand Down Expand Up @@ -133,9 +132,8 @@ def test_quantum_type_declaration_succeed(self):
result = self.parse_qutes_code(code)

actual_value_of_var = str(result.variables_handler.get_variable_symbol(var_name, self.TOKEN_AST_INDEX_FOR_TESTS).value)
self.assertEquals(actual_value_of_var, str(expected_value_of_var), f"Expected value: {expected_value_of_var}, actual value: {actual_value_of_var}")
self.assertEqual(actual_value_of_var, str(expected_value_of_var), f"Expected value: {expected_value_of_var}, actual value: {actual_value_of_var}")


def test_quantum_type_declaration_throws(self):
params = [
("qubit", "10"),
Expand All @@ -156,7 +154,7 @@ def test_quantum_type_declaration_throws(self):
self.parse_qutes_code(code)

def test_double_variable_declaration_throws(self):
code = f"""
code = """
quint a = 5q;
string a = "";
"""
Expand All @@ -174,4 +172,4 @@ def test_variable_shadowing_succeed(self):
result = self.parse_qutes_code(code)
result.scope_handler.push_scope()
actual_value_of_var = str(result.variables_handler.get_variable_symbol(var_name, self.TOKEN_AST_INDEX_FOR_TESTS).value)
self.assertEquals(actual_value_of_var, str(expected_value_of_var), f"Expected value: {expected_value_of_var}, actual value: {actual_value_of_var}")
self.assertEqual(actual_value_of_var, str(expected_value_of_var), f"Expected value: {expected_value_of_var}, actual value: {actual_value_of_var}")
6 changes: 3 additions & 3 deletions src/tests/test_grover.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ def assert_grover_test(self, code, var_name, expected_value_of_var):
try:
result = self.parse_qutes_code(code)
actual_value_of_var = str(result.variables_handler.get_variable_symbol(var_name, self.TOKEN_AST_INDEX_FOR_TESTS).value)
self.assertEquals(actual_value_of_var, str(expected_value_of_var), f"Expected value: {expected_value_of_var}, actual value: {actual_value_of_var}")
self.assertEqual(actual_value_of_var, str(expected_value_of_var), f"Expected value: {expected_value_of_var}, actual value: {actual_value_of_var}")
except:
result = self.parse_qutes_code(code)
actual_value_of_var = str(result.variables_handler.get_variable_symbol(var_name, self.TOKEN_AST_INDEX_FOR_TESTS).value)
self.assertEquals(actual_value_of_var, str(expected_value_of_var), f"Expected value: {expected_value_of_var}, actual value: {actual_value_of_var}")
self.assertEqual(actual_value_of_var, str(expected_value_of_var), f"Expected value: {expected_value_of_var}, actual value: {actual_value_of_var}")

def test_grover_substring_search_return_true(self):
params = [
Expand Down Expand Up @@ -60,4 +60,4 @@ def test_grover_substring_search_return_false(self):
{var_name} = true;
}}
"""
self.assert_grover_test(code, var_name, expected_value_of_var)
self.assert_grover_test(code, var_name, expected_value_of_var)

0 comments on commit 6653086

Please sign in to comment.