diff --git a/main.py b/main.py index 857ca7d..080851f 100644 --- a/main.py +++ b/main.py @@ -10,7 +10,7 @@ def index(username = None): @app.route('/contact') def contact(): - return "

Book your first consultation:

Epasts: example@example.com

" + return render_template("contact.html") @app.route('/') @app.route('/') def first_page(): @@ -21,7 +21,9 @@ def login(): username = request.form['username'] return redirect(url_for('index', username=escape(username))) return render_template("form.html") - +@app.route('/') +def first_page(): + return render_template("test.html") import unittest @@ -32,8 +34,49 @@ class TestStringMethods(unittest.TestCase): response = client.get(response.location) self.assertEqual(response.status_code, 200) self.assertIn("Test", response.text) - + # ... -if __name__ == '__main__': - unittest.main() +class TestCategorizeByAge(unittest.TestCase): + def test_child(self): + """Test for 'Child'""" + self.assertEqual(categorize_by_age(5), "Child") + def test_adolescent(self): + """Test for 'Adolescent'""" + self.assertEqual(categorize_by_age(15), "Adolescent") + + def test_adult(self): + """Test for 'Adult'""" + self.assertEqual(categorize_by_age(30), "Adult") + + def test_golden_age(self): + """Test for 'Golden age'""" + self.assertEqual(categorize_by_age(70), "Golden age") + + def test_negative_age(self): + """Test for negative age""" + self.assertEqual(categorize_by_age(-1), "Invalid age: -1") + + def test_too_old(self): + """Test for too old""" + self.assertEqual(categorize_by_age(151), "Invalid age: 151") + + def test_boundary_child_adolescent(self): + """Test for boundary between 'Child' and 'Adolescent'""" + self.assertEqual(categorize_by_age(9), "Child") + self.assertEqual(categorize_by_age(10), "Adolescent") + + def test_boundary_adolescent_adult(self): + """Test for boundary between 'Adolescent' and 'Adult'""" + self.assertEqual(categorize_by_age(18), "Adolescent") + self.assertEqual(categorize_by_age(19), "Adult") + + def test_boundary_adult_golden_age(self): + """Test for boundary between 'Adult' and 'Golden age'""" + self.assertEqual(categorize_by_age(65), "Adult") + self.assertEqual(categorize_by_age(66), "Golden age") + + + +if __name__ == "__main__": + unittest.main(verbosity=2)