From a43c32c9eb3bd22e1f76303662812b0d66a95ae9 Mon Sep 17 00:00:00 2001 From: ongsici Date: Mon, 28 Oct 2024 14:01:42 +0000 Subject: [PATCH] feat: name query --- src/app.py | 4 +++- src/test_app.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app.py b/src/app.py index cdc6e36..c599727 100644 --- a/src/app.py +++ b/src/app.py @@ -3,6 +3,8 @@ def process_query(input): + if "your name" in input: + return "SiCi" if input == "dinosaurs": return "Dinosaurs ruled the Earth 200 million years ago" else: @@ -36,5 +38,5 @@ def submit(): @app.route("/query", methods=["GET"]) def query(): - q = request.args.get("q") + q = request.args.get("q", "") return process_query(q) diff --git a/src/test_app.py b/src/test_app.py index f2b0950..531406f 100644 --- a/src/test_app.py +++ b/src/test_app.py @@ -10,6 +10,9 @@ def test_knows_about_dinosaurs(): def test_does_not_know_about_asteroids(): assert process_query("asteroids") == "Unknown" +def test_what_is_your_name(): + assert process_query("What is your name?") == "SiCi" + @pytest.fixture def client():