Allow decorator without parentheses

This commit is contained in:
Antonio Feregrino
2021-05-02 13:10:19 +01:00
parent 7c7f4ae30d
commit 22f04b2347
2 changed files with 20 additions and 3 deletions

View File

@ -42,6 +42,18 @@ def test_default_template_name_pt():
assert '<h1>Hello default WORLD!</h1>' in html
def test_default_template_name_no_parentheses():
@fc.template
def index(a, b, c):
return {'a': a, 'b': b, 'c': c, 'world': 'WORLD'}
resp = index(1, 2, 3)
assert isinstance(resp, fastapi.Response)
assert resp.status_code == 200
html = resp.body.decode('utf-8')
assert '<h1>Hello default WORLD!</h1>' in html
def test_default_template_name_html():
@fc.template()
def details(a, b, c):