Skip to content

Commit

Permalink
chore: Change deprecated function assertEquals to assertEqual (amunds…
Browse files Browse the repository at this point in the history
…en-io#224)

Signed-off-by: Wonyeong Choi <ciwnyg0815@gmail.com>
  • Loading branch information
Wonong authored Nov 4, 2020
1 parent 62c65fe commit f4ed92a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions tests/unit/proxy/roundtrip/test_neptune_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ def test_explain(self) -> None:

def test_profile(self) -> None:
count = self._get(label=VertexTypes.User, key='jack', extra_traversal=__.count())
self.assertEquals(count, 0)
self.assertEqual(count, 0)
# just enough to not explode
self._upsert(label=VertexTypes.User, key='jack', email='jack@squareup.com')
# and show it ran
count = self._get(label=VertexTypes.User, key='jack', extra_traversal=__.count())
self.assertEquals(count, 1)
self.assertEqual(count, 1)
58 changes: 29 additions & 29 deletions tests/unit/proxy/test_neo4j_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def test_get_table_with_valid_description(self) -> None:
mock_execute.assert_called_with(statement=table_description_query,
param_dict={'key': 'test_table'})

self.assertEquals(table_description, 'sample description')
self.assertEqual(table_description, 'sample description')

def test_get_table_with_no_description(self) -> None:
"""
Expand Down Expand Up @@ -300,8 +300,8 @@ def test_put_table_description(self) -> None:
neo4j_proxy.put_table_description(table_uri='test_table',
description='test_description')

self.assertEquals(mock_run.call_count, 2)
self.assertEquals(mock_commit.call_count, 1)
self.assertEqual(mock_run.call_count, 2)
self.assertEqual(mock_commit.call_count, 1)

def test_get_column_with_valid_description(self) -> None:
"""
Expand All @@ -323,7 +323,7 @@ def test_get_column_with_valid_description(self) -> None:
param_dict={'tbl_key': 'test_table',
'column_name': 'test_column'})

self.assertEquals(col_description, 'sample description')
self.assertEqual(col_description, 'sample description')

def test_get_column_with_no_description(self) -> None:
"""
Expand Down Expand Up @@ -369,8 +369,8 @@ def test_put_column_description(self) -> None:
column_name='test_column',
description='test_description')

self.assertEquals(mock_run.call_count, 2)
self.assertEquals(mock_commit.call_count, 1)
self.assertEqual(mock_run.call_count, 2)
self.assertEqual(mock_commit.call_count, 1)

def test_add_owner(self) -> None:
with patch.object(GraphDatabase, 'driver') as mock_driver:
Expand All @@ -389,8 +389,8 @@ def test_add_owner(self) -> None:
neo4j_proxy.add_owner(table_uri='dummy_uri',
owner='tester')
# we call neo4j twice in add_owner call
self.assertEquals(mock_run.call_count, 2)
self.assertEquals(mock_commit.call_count, 1)
self.assertEqual(mock_run.call_count, 2)
self.assertEqual(mock_commit.call_count, 1)

def test_delete_owner(self) -> None:
with patch.object(GraphDatabase, 'driver') as mock_driver:
Expand All @@ -409,8 +409,8 @@ def test_delete_owner(self) -> None:
neo4j_proxy.delete_owner(table_uri='dummy_uri',
owner='tester')
# we only call neo4j once in delete_owner call
self.assertEquals(mock_run.call_count, 1)
self.assertEquals(mock_commit.call_count, 1)
self.assertEqual(mock_run.call_count, 1)
self.assertEqual(mock_commit.call_count, 1)

def test_add_badge(self) -> None:
with patch.object(GraphDatabase, 'driver') as mock_driver:
Expand All @@ -429,8 +429,8 @@ def test_add_badge(self) -> None:
neo4j_proxy.add_badge(id='dummy_uri',
badge_name='hive')
# we call neo4j twice in add_tag call
self.assertEquals(mock_run.call_count, 3)
self.assertEquals(mock_commit.call_count, 1)
self.assertEqual(mock_run.call_count, 3)
self.assertEqual(mock_commit.call_count, 1)

def test_add_tag(self) -> None:
with patch.object(GraphDatabase, 'driver') as mock_driver:
Expand All @@ -449,8 +449,8 @@ def test_add_tag(self) -> None:
neo4j_proxy.add_tag(id='dummy_uri',
tag='hive')
# we call neo4j twice in add_tag call
self.assertEquals(mock_run.call_count, 3)
self.assertEquals(mock_commit.call_count, 1)
self.assertEqual(mock_run.call_count, 3)
self.assertEqual(mock_commit.call_count, 1)

def test_delete_tag(self) -> None:
with patch.object(GraphDatabase, 'driver') as mock_driver:
Expand All @@ -469,8 +469,8 @@ def test_delete_tag(self) -> None:
neo4j_proxy.delete_tag(id='dummy_uri',
tag='hive')
# we only call neo4j once in delete_tag call
self.assertEquals(mock_run.call_count, 1)
self.assertEquals(mock_commit.call_count, 1)
self.assertEqual(mock_run.call_count, 1)
self.assertEqual(mock_commit.call_count, 1)

def test_get_tags(self) -> None:
with patch.object(GraphDatabase, 'driver'), patch.object(Neo4jProxy, '_execute_cypher_query') as mock_execute:
Expand Down Expand Up @@ -498,7 +498,7 @@ def test_get_neo4j_latest_updated_ts(self) -> None:
}
neo4j_proxy = Neo4jProxy(host='DOES_NOT_MATTER', port=0000)
neo4j_last_updated_ts = neo4j_proxy.get_latest_updated_ts()
self.assertEquals(neo4j_last_updated_ts, '1000')
self.assertEqual(neo4j_last_updated_ts, '1000')

mock_execute.return_value.single.return_value = {
'ts': {
Expand All @@ -524,7 +524,7 @@ def test_get_popular_tables(self) -> None:
self.assertEqual(neo4j_proxy._get_popular_tables_uris(2), ['foo', 'bar'])
self.assertEqual(neo4j_proxy._get_popular_tables_uris(2), ['foo', 'bar'])

self.assertEquals(mock_execute.call_count, 1)
self.assertEqual(mock_execute.call_count, 1)

with patch.object(GraphDatabase, 'driver'), patch.object(Neo4jProxy, '_execute_cypher_query') as mock_execute:
mock_execute.return_value = [
Expand Down Expand Up @@ -563,7 +563,7 @@ def test_get_user(self) -> None:
}
neo4j_proxy = Neo4jProxy(host='DOES_NOT_MATTER', port=0000)
neo4j_user = neo4j_proxy.get_user(id='test_email')
self.assertEquals(neo4j_user.email, 'test_email')
self.assertEqual(neo4j_user.email, 'test_email')

def test_get_user_other_key_values(self) -> None:
with patch.object(GraphDatabase, 'driver'), patch.object(Neo4jProxy, '_execute_cypher_query') as mock_execute:
Expand All @@ -587,7 +587,7 @@ def test_get_user_other_key_values(self) -> None:
}
neo4j_proxy = Neo4jProxy(host='DOES_NOT_MATTER', port=0000)
neo4j_user = neo4j_proxy.get_user(id='test_email')
self.assertEquals(neo4j_user.other_key_values, {'mode_user_id': 'mode_foo_bar'})
self.assertEqual(neo4j_user.other_key_values, {'mode_user_id': 'mode_foo_bar'})

def test_get_users(self) -> None:
with patch.object(GraphDatabase, 'driver'), patch.object(Neo4jProxy, '_execute_cypher_query') as mock_execute:
Expand Down Expand Up @@ -617,8 +617,8 @@ def test_get_users(self) -> None:
'team_name',
'email',
'manager_fullname']:
self.assertEquals(getattr(users[0], attr),
getattr(actual_data[0], attr))
self.assertEqual(getattr(users[0], attr),
getattr(actual_data[0], attr))

def test_get_table_by_user_relation(self) -> None:
with patch.object(GraphDatabase, 'driver'), patch.object(Neo4jProxy, '_execute_cypher_query') as mock_execute:
Expand Down Expand Up @@ -699,8 +699,8 @@ def test_add_resource_relation_by_user(self) -> None:
user_id='tester',
relation_type=UserResourceRel.follow,
resource_type=ResourceType.Table)
self.assertEquals(mock_run.call_count, 2)
self.assertEquals(mock_commit.call_count, 1)
self.assertEqual(mock_run.call_count, 2)
self.assertEqual(mock_commit.call_count, 1)

def test_delete_resource_relation_by_user(self) -> None:
with patch.object(GraphDatabase, 'driver') as mock_driver:
Expand All @@ -720,8 +720,8 @@ def test_delete_resource_relation_by_user(self) -> None:
user_id='tester',
relation_type=UserResourceRel.follow,
resource_type=ResourceType.Table)
self.assertEquals(mock_run.call_count, 1)
self.assertEquals(mock_commit.call_count, 1)
self.assertEqual(mock_run.call_count, 1)
self.assertEqual(mock_commit.call_count, 1)

def test_get_invalid_user(self) -> None:
with patch.object(GraphDatabase, 'driver'), patch.object(Neo4jProxy, '_execute_cypher_query') as mock_execute:
Expand Down Expand Up @@ -906,7 +906,7 @@ def test_get_dashboard_with_valid_description(self) -> None:
mock_execute.assert_called_with(statement=dashboard_description_query,
param_dict={'key': 'test_dashboard'})

self.assertEquals(table_description.description, 'sample description')
self.assertEqual(table_description.description, 'sample description')

def test_get_dashboard_with_no_description(self) -> None:
"""
Expand Down Expand Up @@ -949,8 +949,8 @@ def test_put_dashboard_description(self) -> None:
neo4j_proxy.put_dashboard_description(id='test_dashboard',
description='test_description')

self.assertEquals(mock_run.call_count, 2)
self.assertEquals(mock_commit.call_count, 1)
self.assertEqual(mock_run.call_count, 2)
self.assertEqual(mock_commit.call_count, 1)

expected_stmt = textwrap.dedent("""
MATCH (n1:Description {key: $desc_key}), (n2:Dashboard {key: $key})
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_swagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ def tearDown(self) -> None:

def test_should_get_swagger_docs(self) -> None:
response = self.app.test_client().get('/apidocs/')
self.assertEquals(response.status_code, 200)
self.assertEqual(response.status_code, 200)

def test_should_get_swagger_json(self) -> None:
response = self.app.test_client().get('/apispec_1.json')

self.assertEquals(response.status_code, 200)
self.assertEqual(response.status_code, 200)

def test_should_have_a_component_from_each_reference(self) -> None:
response = self.app.test_client().get('/apispec_1.json')
Expand Down

0 comments on commit f4ed92a

Please sign in to comment.