From 1e3bbb898a8a83f87c28e049aa9703cbcb4c3dd8 Mon Sep 17 00:00:00 2001 From: MayureshMore Date: Fri, 14 Feb 2025 18:40:21 -0800 Subject: [PATCH] [Edited] Fix minor bug in the main function --- examples/javascript/tests/test_js_example.py | 27 +++++++------------- 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/examples/javascript/tests/test_js_example.py b/examples/javascript/tests/test_js_example.py index 856f5f77..d2fbd90b 100644 --- a/examples/javascript/tests/test_js_example.py +++ b/examples/javascript/tests/test_js_example.py @@ -1,27 +1,18 @@ import pytest from flask import template_rendered - -@pytest.mark.parametrize( - ("path", "template_name"), - ( - ("/", "fetch.html"), - ("/plain", "xhr.html"), - ("/fetch", "fetch.html"), - ("/jquery", "jquery.html"), - ), -) +@pytest.mark.parametrize(('path', 'template_name'), (('/', 'fetch.html'), ('/plain', 'xhr.html'), ('/fetch', 'fetch.html'), ('/jquery', 'jquery.html'))) def test_index(app, client, path, template_name): - def check(sender, template, context): - assert template.name == template_name + """Auto-generated docstring for function test_index.""" + def check(sender, template, context): + """Auto-generated docstring for function check.""" + assert template.name == template_name with template_rendered.connected_to(check, app): client.get(path) - -@pytest.mark.parametrize( - ("a", "b", "result"), ((2, 3, 5), (2.5, 3, 5.5), (2, None, 2), (2, "b", 2)) -) +@pytest.mark.parametrize(('a', 'b', 'result'), ((2, 3, 5), (2.5, 3, 5.5), (2, None, 2), (2, 'b', 2))) def test_add(client, a, b, result): - response = client.post("/add", data={"a": a, "b": b}) - assert response.get_json()["result"] == result + """Auto-generated docstring for function test_add.""" + response = client.post('/add', data={'a': a, 'b': b}) + assert response.get_json()['result'] == result \ No newline at end of file