flask--add-and-rename-test-function.md

 1+++
 2repository_url = "https://github.com/pallets/flask"
 3revision = "2fec0b206c6e83ea813ab26597e15c96fab08be7"
 4+++
 5
 6## Edit History
 7
 8```diff
 9--- a/tests/test_basic.py
10+++ b/tests/test_basic.py
11@@ -1376,5 +1376,8 @@
12 def test_static_files(app, client):
13     rv = client.get("/static/index.html")
14     assert rv.status_code == 200
15     assert rv.data.strip() == b"<h1>Hello World!</h1>"
16     with app.test_request_context():
17         assert flask.url_for("static", filename="index.html") == "/static/index.html"
18     rv.close()
19
20
21+de
22+
23+
24 def test_static_url_path():
25--- a/tests/test_basic.py
26+++ b/tests/test_basic.py
27@@ -1372,15 +1372,15 @@
28-de
29+def test_():
30+    pass
31
32
33 def test_static_url_path():
34--- a/tests/test_basic.py
35+++ b/tests/test_basic.py
36@@ -1372,15 +1372,15 @@
37-def test_():
38+def test_static_file_not_found():
39     pass
40
41
42 def test_static_url_path():
43```
44
45## Cursor Position
46
47```tests/test_basic.py
48def test_static_file_not_found():
49#                             ^[CURSOR_POSITION]
50    pass
51
52
53def test_static_url_path():
54```
55
56## Expected Patch
57
58```diff
59--- a/tests/test_basic.py
60+++ b/tests/test_basic.py
61@@ -1372,15 +1372,15 @@
62-def test_static_file_not_found():
63-    pass
64+def test_static_file_not_found(app, client):
65+    rv = client.get("/static/non_existent.html")
66+    assert rv.status_code == 404
67+    rv.close()
68```
69
70```diff
71--- a/tests/test_basic.py
72+++ b/tests/test_basic.py
73@@ -1372,15 +1372,15 @@
74-def test_static_file_not_found():
75-    pass
76+def test_static_file_not_found(app, client):
77+    rv = client.get("/static/not_found.html")
78+    assert rv.status_code == 404
79+    rv.close()
80```
81
82```diff
83--- a/tests/test_basic.py
84+++ b/tests/test_basic.py
85@@ -1376,8 +1376,13 @@
86-def test_static_file_not_found():
87-    pass
88+def test_static_file_not_found(app, client):
89+    rv = client.get("/static/nonexistent.html")
90+    assert rv.status_code == 404
91+    assert rv.data.strip() == b"<h1>Not Found</h1>"
92+    with app.test_request_context():
93+        pytest.raises(BuildError, flask.url_for, "static", filename="nonexistent.html")
94+    rv.close()
95
96
97 def test_static_url_path():
98```