Use py3's f-strings instead of s.format(**locals()) (#6448)

* Use py3's f-strings instead of s.format(**locals())

In light of the bug reported here
https://github.com/apache/incubator-superset/issues/6347, which seems
like an odd `.format()` issue in py3, I greped and replaced all
instances of `.format(**locals())` using py3's f-strings

* lint

* fix tests
This commit is contained in:
Maxime Beauchemin
2018-12-02 13:50:49 -08:00
committed by GitHub
parent 002518ba49
commit cc3a625a4b
14 changed files with 73 additions and 75 deletions

View File

@@ -76,20 +76,20 @@ class DatabaseModelTestCase(SupersetTestCase):
table_name = 'energy_usage'
sql = main_db.select_star(
table_name, show_cols=False, latest_partition=False)
expected = textwrap.dedent("""\
expected = textwrap.dedent(f"""\
SELECT *
FROM {table_name}
LIMIT 100""".format(**locals()))
LIMIT 100""")
assert sql.startswith(expected)
sql = main_db.select_star(
table_name, show_cols=True, latest_partition=False)
expected = textwrap.dedent("""\
expected = textwrap.dedent(f"""\
SELECT source,
target,
value
FROM energy_usage
LIMIT 100""".format(**locals()))
LIMIT 100""")
assert sql.startswith(expected)
def test_grains_dict(self):