Skip to content

Commit ef9e01f

Browse files
Refactor regex patterns in test.py to allow for both single and double quotes in route definitions
1 parent cdb1649 commit ef9e01f

File tree

1 file changed

+2
-2
lines changed
  • .learn/exercises/03.3-your-first-route

1 file changed

+2
-2
lines changed

.learn/exercises/03.3-your-first-route/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ def test_declare_variable2():
3434
path = 'src/app.py'
3535
with open(path, 'r') as content_file:
3636
content = content_file.read()
37-
regex = re.compile(r"@app\.route(\s*)\((\s*)'\/[a-zA-Z0-9]+'(\s*),(\s*)methods=(\s*)\[(\s*)'GET'(\s*)\](\s*)\)")
37+
regex = re.compile(r"@app\.route(\s*)\((\s*)[\'\"]\/[a-zA-Z0-9]+[\'\"](\s*),(\s*)methods=(\s*)\[(\s*)[\'\"]GET[\'\"](\s*)\](\s*)\)")
3838
assert bool(regex.search(content)) == True
3939

4040
@pytest.mark.it("Make sure '/todos' is the route you specified inside the @app.route decorator")
4141
def test_declare_variable3():
4242
path = 'src/app.py'
4343
with open(path, 'r') as content_file:
4444
content = content_file.read()
45-
regex = re.compile(r"'\/todos'")
45+
regex = re.compile(r"[\'\"]\/todos[\'\"]")
4646
assert bool(regex.search(content)) == True
4747

4848
@pytest.mark.it("Endpoint for path '/todos' must exist")

0 commit comments

Comments
 (0)