mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
f-strings only date back to Py3.6
This commit is contained in:
parent
13c5d72bd1
commit
93d2687d24
@ -57,8 +57,8 @@ class Config(object):
|
||||
for k in sorted(self.settings):
|
||||
v = self.settings[k].value
|
||||
if callable(v):
|
||||
v = "<%s()>" % v.__qualname__
|
||||
lines.append(f"{k:{kmax}} = {v}")
|
||||
v = "<{}()>".format(v.__qualname__)
|
||||
lines.append("{k:{kmax}} = {v}".format(k=k, v=v, kmax=kmax))
|
||||
return "\n".join(lines)
|
||||
|
||||
def __getattr__(self, name):
|
||||
|
||||
@ -454,7 +454,7 @@ def test_str():
|
||||
}
|
||||
for i, line in enumerate(o.splitlines()):
|
||||
m = re.match(r'^(\w+)\s+= ', line)
|
||||
assert m, f"Config line {i} didn't match expected format: {line!r}"
|
||||
assert m, "Line {} didn't match expected format: {!r}".format(i, line)
|
||||
|
||||
key = m.group(1)
|
||||
try:
|
||||
@ -462,10 +462,12 @@ def test_str():
|
||||
except KeyError:
|
||||
continue
|
||||
|
||||
line_re = fr'^{key}\s+= {re.escape(s)}$'
|
||||
assert re.match(line_re, line), f'{line_re!r} != {line!r}'
|
||||
line_re = r'^{}\s+= {}$'.format(key, re.escape(s))
|
||||
assert re.match(line_re, line), '{!r} != {!r}'.format(line_re, line)
|
||||
|
||||
if not OUTPUT_MATCH:
|
||||
break
|
||||
else:
|
||||
assert False, f'missing expected setting lines? {list(OUTPUT_MATCH.keys())}'
|
||||
assert False, 'missing expected setting lines? {}'.format(
|
||||
OUTPUT_MATCH.keys()
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user