Skip to content

Commit

Permalink
s/assertEqual/assertEquals (apache#10195)
Browse files Browse the repository at this point in the history
Co-authored-by: bogdan kyryliuk <[email protected]>
  • Loading branch information
bkyryliuk and bogdan-dbx authored Jun 29, 2020
1 parent 4e340c8 commit 77b3678
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 57 deletions.
10 changes: 5 additions & 5 deletions tests/config_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,15 @@ def test_python_date_format_by_column_name(self):
self.createTable(table_defaults)
id_col = [c for c in self._logs_table.columns if c.column_name == "id"][0]
self.assertTrue(id_col.is_dttm)
self.assertEquals(id_col.python_date_format, "epoch_ms")
self.assertEqual(id_col.python_date_format, "epoch_ms")
dttm_col = [c for c in self._logs_table.columns if c.column_name == "dttm"][0]
self.assertTrue(dttm_col.is_dttm)
self.assertEquals(dttm_col.python_date_format, "epoch_s")
self.assertEqual(dttm_col.python_date_format, "epoch_s")
dms_col = [
c for c in self._logs_table.columns if c.column_name == "duration_ms"
][0]
self.assertTrue(dms_col.is_dttm)
self.assertEquals(dms_col.python_date_format, "invalid")
self.assertEqual(dms_col.python_date_format, "invalid")

def test_expression_by_column_name(self):
table_defaults = {
Expand All @@ -160,12 +160,12 @@ def test_full_setting(self):

id_col = [c for c in self._logs_table.columns if c.column_name == "id"][0]
self.assertTrue(id_col.is_dttm)
self.assertEquals(id_col.python_date_format, "epoch_ms")
self.assertEqual(id_col.python_date_format, "epoch_ms")
self.assertIsNone(id_col.expression)

dttm_col = [c for c in self._logs_table.columns if c.column_name == "dttm"][0]
self.assertTrue(dttm_col.is_dttm)
self.assertEquals(dttm_col.python_date_format, "epoch_s")
self.assertEqual(dttm_col.python_date_format, "epoch_s")
self.assertEqual(dttm_col.expression, "CAST(dttm as INTEGER)")


Expand Down
2 changes: 1 addition & 1 deletion tests/core_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def test_viz_cache_key(self):

qobj["inner_from_dttm"] = datetime.datetime(1901, 1, 1)

self.assertEquals(cache_key_with_groupby, viz.cache_key(qobj))
self.assertEqual(cache_key_with_groupby, viz.cache_key(qobj))

def test_get_superset_tables_not_allowed(self):
example_db = utils.get_example_database()
Expand Down
4 changes: 2 additions & 2 deletions tests/datasource_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ def test_change_database(self):

datasource_post["database"]["id"] = new_db.id
resp = self.save_datasource_from_dict(datasource_post)
self.assertEquals(resp["database"]["id"], new_db.id)
self.assertEqual(resp["database"]["id"], new_db.id)

datasource_post["database"]["id"] = db_id
resp = self.save_datasource_from_dict(datasource_post)
self.assertEquals(resp["database"]["id"], db_id)
self.assertEqual(resp["database"]["id"], db_id)

self.delete_fake_db()

Expand Down
18 changes: 9 additions & 9 deletions tests/jinja_context_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
class TestJinja2Context(SupersetTestCase):
def test_filter_values_default(self) -> None:
with app.test_request_context():
self.assertEquals(filter_values("name", "foo"), ["foo"])
self.assertEqual(filter_values("name", "foo"), ["foo"])

def test_filter_values_no_default(self) -> None:
with app.test_request_context():
self.assertEquals(filter_values("name"), [])
self.assertEqual(filter_values("name"), [])

def test_filter_values_adhoc_filters(self) -> None:
with app.test_request_context(
Expand All @@ -49,7 +49,7 @@ def test_filter_values_adhoc_filters(self) -> None:
)
}
):
self.assertEquals(filter_values("name"), ["foo"])
self.assertEqual(filter_values("name"), ["foo"])

with app.test_request_context(
data={
Expand All @@ -68,7 +68,7 @@ def test_filter_values_adhoc_filters(self) -> None:
)
}
):
self.assertEquals(filter_values("name"), ["foo", "bar"])
self.assertEqual(filter_values("name"), ["foo", "bar"])

def test_filter_values_extra_filters(self) -> None:
with app.test_request_context(
Expand All @@ -78,22 +78,22 @@ def test_filter_values_extra_filters(self) -> None:
)
}
):
self.assertEquals(filter_values("name"), ["foo"])
self.assertEqual(filter_values("name"), ["foo"])

def test_url_param_default(self) -> None:
with app.test_request_context():
self.assertEquals(ExtraCache().url_param("foo", "bar"), "bar")
self.assertEqual(ExtraCache().url_param("foo", "bar"), "bar")

def test_url_param_no_default(self) -> None:
with app.test_request_context():
self.assertEquals(ExtraCache().url_param("foo"), None)
self.assertEqual(ExtraCache().url_param("foo"), None)

def test_url_param_query(self) -> None:
with app.test_request_context(query_string={"foo": "bar"}):
self.assertEquals(ExtraCache().url_param("foo"), "bar")
self.assertEqual(ExtraCache().url_param("foo"), "bar")

def test_url_param_form_data(self) -> None:
with app.test_request_context(
query_string={"form_data": json.dumps({"url_params": {"foo": "bar"}})}
):
self.assertEquals(ExtraCache().url_param("foo"), "bar")
self.assertEqual(ExtraCache().url_param("foo"), "bar")
6 changes: 3 additions & 3 deletions tests/model_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,6 @@ def test_data_for_slices(self):
)

data_for_slices = tbl.data_for_slices([slc])
self.assertEquals(len(data_for_slices["columns"]), 0)
self.assertEquals(len(data_for_slices["metrics"]), 1)
self.assertEquals(len(data_for_slices["verbose_map"].keys()), 2)
self.assertEqual(len(data_for_slices["columns"]), 0)
self.assertEqual(len(data_for_slices["metrics"]), 1)
self.assertEqual(len(data_for_slices["verbose_map"].keys()), 2)
2 changes: 1 addition & 1 deletion tests/query_context_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def test_query_context_time_range_endpoints(self):
extras = query_object.to_dict()["extras"]
self.assertTrue("time_range_endpoints" in extras)

self.assertEquals(
self.assertEqual(
extras["time_range_endpoints"],
(TimeRangeEndpoint.INCLUSIVE, TimeRangeEndpoint.EXCLUSIVE),
)
Expand Down
70 changes: 35 additions & 35 deletions tests/security_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ def test_set_perm_sqla_table(self):
stored_table = (
session.query(SqlaTable).filter_by(table_name="tmp_perm_table").one()
)
self.assertEquals(
self.assertEqual(
stored_table.perm, f"[examples].[tmp_perm_table](id:{stored_table.id})"
)
self.assertIsNotNone(
security_manager.find_permission_view_menu(
"datasource_access", stored_table.perm
)
)
self.assertEquals(stored_table.schema_perm, "[examples].[tmp_schema]")
self.assertEqual(stored_table.schema_perm, "[examples].[tmp_schema]")
self.assertIsNotNone(
security_manager.find_permission_view_menu(
"schema_access", stored_table.schema_perm
Expand All @@ -151,7 +151,7 @@ def test_set_perm_sqla_table(self):
stored_table = (
session.query(SqlaTable).filter_by(table_name="tmp_perm_table_v2").one()
)
self.assertEquals(
self.assertEqual(
stored_table.perm, f"[examples].[tmp_perm_table_v2](id:{stored_table.id})"
)
self.assertIsNotNone(
Expand All @@ -160,7 +160,7 @@ def test_set_perm_sqla_table(self):
)
)
# no changes in schema
self.assertEquals(stored_table.schema_perm, "[examples].[tmp_schema]")
self.assertEqual(stored_table.schema_perm, "[examples].[tmp_schema]")
self.assertIsNotNone(
security_manager.find_permission_view_menu(
"schema_access", stored_table.schema_perm
Expand All @@ -173,7 +173,7 @@ def test_set_perm_sqla_table(self):
stored_table = (
session.query(SqlaTable).filter_by(table_name="tmp_perm_table_v2").one()
)
self.assertEquals(
self.assertEqual(
stored_table.perm, f"[examples].[tmp_perm_table_v2](id:{stored_table.id})"
)
self.assertIsNotNone(
Expand All @@ -182,7 +182,7 @@ def test_set_perm_sqla_table(self):
)
)
# no changes in schema
self.assertEquals(stored_table.schema_perm, "[examples].[tmp_schema_v2]")
self.assertEqual(stored_table.schema_perm, "[examples].[tmp_schema_v2]")
self.assertIsNotNone(
security_manager.find_permission_view_menu(
"schema_access", stored_table.schema_perm
Expand All @@ -199,7 +199,7 @@ def test_set_perm_sqla_table(self):
stored_table = (
session.query(SqlaTable).filter_by(table_name="tmp_perm_table_v2").one()
)
self.assertEquals(
self.assertEqual(
stored_table.perm, f"[tmp_db].[tmp_perm_table_v2](id:{stored_table.id})"
)
self.assertIsNotNone(
Expand All @@ -208,7 +208,7 @@ def test_set_perm_sqla_table(self):
)
)
# no changes in schema
self.assertEquals(stored_table.schema_perm, "[tmp_db].[tmp_schema_v2]")
self.assertEqual(stored_table.schema_perm, "[tmp_db].[tmp_schema_v2]")
self.assertIsNotNone(
security_manager.find_permission_view_menu(
"schema_access", stored_table.schema_perm
Expand All @@ -221,7 +221,7 @@ def test_set_perm_sqla_table(self):
stored_table = (
session.query(SqlaTable).filter_by(table_name="tmp_perm_table_v2").one()
)
self.assertEquals(
self.assertEqual(
stored_table.perm, f"[tmp_db].[tmp_perm_table_v2](id:{stored_table.id})"
)
self.assertIsNotNone(
Expand Down Expand Up @@ -254,7 +254,7 @@ def test_set_perm_druid_datasource(self):
.filter_by(datasource_name="tmp_datasource")
.one()
)
self.assertEquals(
self.assertEqual(
stored_datasource.perm,
f"[druid_test].[tmp_datasource](id:{stored_datasource.id})",
)
Expand All @@ -268,7 +268,7 @@ def test_set_perm_druid_datasource(self):
# store with a schema
stored_datasource.datasource_name = "tmp_schema.tmp_datasource"
session.commit()
self.assertEquals(
self.assertEqual(
stored_datasource.perm,
f"[druid_test].[tmp_schema.tmp_datasource](id:{stored_datasource.id})",
)
Expand Down Expand Up @@ -297,7 +297,7 @@ def test_set_perm_druid_cluster(self):
.filter_by(cluster_name="tmp_druid_cluster")
.one()
)
self.assertEquals(
self.assertEqual(
stored_cluster.perm, f"[tmp_druid_cluster].(id:{stored_cluster.id})"
)
self.assertIsNotNone(
Expand All @@ -308,7 +308,7 @@ def test_set_perm_druid_cluster(self):

stored_cluster.cluster_name = "tmp_druid_cluster2"
session.commit()
self.assertEquals(
self.assertEqual(
stored_cluster.perm, f"[tmp_druid_cluster2].(id:{stored_cluster.id})"
)
self.assertIsNotNone(
Expand All @@ -330,7 +330,7 @@ def test_set_perm_database(self):
stored_db = (
session.query(Database).filter_by(database_name="tmp_database").one()
)
self.assertEquals(stored_db.perm, f"[tmp_database].(id:{stored_db.id})")
self.assertEqual(stored_db.perm, f"[tmp_database].(id:{stored_db.id})")
self.assertIsNotNone(
security_manager.find_permission_view_menu(
"database_access", stored_db.perm
Expand All @@ -342,7 +342,7 @@ def test_set_perm_database(self):
stored_db = (
session.query(Database).filter_by(database_name="tmp_database2").one()
)
self.assertEquals(stored_db.perm, f"[tmp_database2].(id:{stored_db.id})")
self.assertEqual(stored_db.perm, f"[tmp_database2].(id:{stored_db.id})")
self.assertIsNotNone(
security_manager.find_permission_view_menu(
"database_access", stored_db.perm
Expand All @@ -368,9 +368,9 @@ def test_hybrid_perm_druid_cluster(self):
.one()
)

self.assertEquals(record.get_perm(), record.perm)
self.assertEquals(record.id, id_)
self.assertEquals(record.cluster_name, "tmp_druid_cluster3")
self.assertEqual(record.get_perm(), record.perm)
self.assertEqual(record.id, id_)
self.assertEqual(record.cluster_name, "tmp_druid_cluster3")
db.session.delete(cluster)
db.session.commit()

Expand All @@ -393,9 +393,9 @@ def test_hybrid_perm_database(self):
.one()
)

self.assertEquals(record.get_perm(), record.perm)
self.assertEquals(record.id, id_)
self.assertEquals(record.database_name, "tmp_database3")
self.assertEqual(record.get_perm(), record.perm)
self.assertEqual(record.id, id_)
self.assertEqual(record.database_name, "tmp_database3")
db.session.delete(database)
db.session.commit()

Expand All @@ -420,18 +420,18 @@ def test_set_perm_slice(self):
session.commit()

slice = session.query(Slice).filter_by(slice_name="slice_name").one()
self.assertEquals(slice.perm, table.perm)
self.assertEquals(slice.perm, f"[tmp_database].[tmp_perm_table](id:{table.id})")
self.assertEquals(slice.schema_perm, table.schema_perm)
self.assertEqual(slice.perm, table.perm)
self.assertEqual(slice.perm, f"[tmp_database].[tmp_perm_table](id:{table.id})")
self.assertEqual(slice.schema_perm, table.schema_perm)
self.assertIsNone(slice.schema_perm)

table.schema = "tmp_perm_schema"
table.table_name = "tmp_perm_table_v2"
session.commit()
# TODO(bogdan): modify slice permissions on the table update.
self.assertNotEquals(slice.perm, table.perm)
self.assertEquals(slice.perm, f"[tmp_database].[tmp_perm_table](id:{table.id})")
self.assertEquals(
self.assertEqual(slice.perm, f"[tmp_database].[tmp_perm_table](id:{table.id})")
self.assertEqual(
table.perm, f"[tmp_database].[tmp_perm_table_v2](id:{table.id})"
)
# TODO(bogdan): modify slice schema permissions on the table update.
Expand All @@ -441,12 +441,12 @@ def test_set_perm_slice(self):
# updating slice refreshes the permissions
slice.slice_name = "slice_name_v2"
session.commit()
self.assertEquals(slice.perm, table.perm)
self.assertEquals(
self.assertEqual(slice.perm, table.perm)
self.assertEqual(
slice.perm, f"[tmp_database].[tmp_perm_table_v2](id:{table.id})"
)
self.assertEquals(slice.schema_perm, table.schema_perm)
self.assertEquals(slice.schema_perm, "[tmp_database].[tmp_perm_schema]")
self.assertEqual(slice.schema_perm, table.schema_perm)
self.assertEqual(slice.schema_perm, "[tmp_database].[tmp_perm_schema]")

session.delete(slice)
session.delete(table)
Expand All @@ -464,7 +464,7 @@ def test_schemas_accessible_by_user_admin(self, mock_g):
schemas = security_manager.get_schemas_accessible_by_user(
database, ["1", "2", "3"]
)
self.assertEquals(schemas, ["1", "2", "3"]) # no changes
self.assertEqual(schemas, ["1", "2", "3"]) # no changes

@patch("superset.security.manager.g")
def test_schemas_accessible_by_user_schema_access(self, mock_g):
Expand All @@ -477,7 +477,7 @@ def test_schemas_accessible_by_user_schema_access(self, mock_g):
database, ["1", "2", "3"]
)
# temp_schema is not passed in the params
self.assertEquals(schemas, ["1"])
self.assertEqual(schemas, ["1"])
delete_schema_perm("[examples].[1]")

@patch("superset.security.manager.g")
Expand All @@ -489,7 +489,7 @@ def test_schemas_accessible_by_user_datasource_access(self, mock_g):
schemas = security_manager.get_schemas_accessible_by_user(
database, ["temp_schema", "2", "3"]
)
self.assertEquals(schemas, ["temp_schema"])
self.assertEqual(schemas, ["temp_schema"])

@patch("superset.security.manager.g")
def test_schemas_accessible_by_user_datasource_and_schema_access(self, mock_g):
Expand All @@ -501,7 +501,7 @@ def test_schemas_accessible_by_user_datasource_and_schema_access(self, mock_g):
schemas = security_manager.get_schemas_accessible_by_user(
database, ["temp_schema", "2", "3"]
)
self.assertEquals(schemas, ["temp_schema", "2"])
self.assertEqual(schemas, ["temp_schema", "2"])
vm = security_manager.find_permission_view_menu(
"schema_access", "[examples].[2]"
)
Expand Down Expand Up @@ -549,7 +549,7 @@ def test_sqllab_gamma_user_schema_access_to_sqllab(self):
NEW_FLASK_GET_SQL_DBS_REQUEST = f"/api/v1/database/?q={prison.dumps(arguments)}"
self.login(username="gamma")
databases_json = self.client.get(NEW_FLASK_GET_SQL_DBS_REQUEST).json
self.assertEquals(databases_json["count"], 1)
self.assertEqual(databases_json["count"], 1)
self.logout()

def assert_can_read(self, view_menu, permissions_set):
Expand Down
2 changes: 1 addition & 1 deletion tests/utils_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ def test_merge_request_params_when_url_params_predefined(self):
merge_request_params(form_data, url_params)
self.assertIn("url_params", form_data.keys())
self.assertIn("abc", form_data["url_params"])
self.assertEquals(
self.assertEqual(
url_params["dashboard_ids"], form_data["url_params"]["dashboard_ids"]
)

Expand Down

0 comments on commit 77b3678

Please sign in to comment.