mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
chore: enable lint PT009 'use regular assert over self.assert.*' (#30521)
This commit is contained in:
committed by
GitHub
parent
1f013055d2
commit
a849c29288
@@ -59,8 +59,8 @@ class TestCache(SupersetTestCase):
|
||||
)
|
||||
# restore DATA_CACHE_CONFIG
|
||||
app.config["DATA_CACHE_CONFIG"] = data_cache_config
|
||||
self.assertFalse(resp["is_cached"])
|
||||
self.assertFalse(resp_from_cache["is_cached"])
|
||||
assert not resp["is_cached"]
|
||||
assert not resp_from_cache["is_cached"]
|
||||
|
||||
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
|
||||
def test_slice_data_cache(self):
|
||||
@@ -84,20 +84,20 @@ class TestCache(SupersetTestCase):
|
||||
resp_from_cache = self.get_json_resp(
|
||||
json_endpoint, {"form_data": json.dumps(slc.viz.form_data)}
|
||||
)
|
||||
self.assertFalse(resp["is_cached"])
|
||||
self.assertTrue(resp_from_cache["is_cached"])
|
||||
assert not resp["is_cached"]
|
||||
assert resp_from_cache["is_cached"]
|
||||
# should fallback to default cache timeout
|
||||
self.assertEqual(resp_from_cache["cache_timeout"], 10)
|
||||
self.assertEqual(resp_from_cache["status"], QueryStatus.SUCCESS)
|
||||
self.assertEqual(resp["data"], resp_from_cache["data"])
|
||||
self.assertEqual(resp["query"], resp_from_cache["query"])
|
||||
assert resp_from_cache["cache_timeout"] == 10
|
||||
assert resp_from_cache["status"] == QueryStatus.SUCCESS
|
||||
assert resp["data"] == resp_from_cache["data"]
|
||||
assert resp["query"] == resp_from_cache["query"]
|
||||
# should exists in `data_cache`
|
||||
self.assertEqual(
|
||||
cache_manager.data_cache.get(resp_from_cache["cache_key"])["query"],
|
||||
resp_from_cache["query"],
|
||||
assert (
|
||||
cache_manager.data_cache.get(resp_from_cache["cache_key"])["query"]
|
||||
== resp_from_cache["query"]
|
||||
)
|
||||
# should not exists in `cache`
|
||||
self.assertIsNone(cache_manager.cache.get(resp_from_cache["cache_key"]))
|
||||
assert cache_manager.cache.get(resp_from_cache["cache_key"]) is None
|
||||
|
||||
# reset cache config
|
||||
app.config["DATA_CACHE_CONFIG"] = data_cache_config
|
||||
|
||||
Reference in New Issue
Block a user