From b69c59f260ab0469c4e084c3d734c3d141e31bd7 Mon Sep 17 00:00:00 2001 From: IvankaKuzin Date: Thu, 5 Dec 2024 19:24:27 +0200 Subject: [PATCH] changed the name of the class for passing tests --- app/main.py | 6 +++--- tests/test_main.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/main.py b/app/main.py index 540f62ad..ff1cc9a7 100644 --- a/app/main.py +++ b/app/main.py @@ -1,7 +1,7 @@ from __future__ import annotations -class OnlineCourse: +class OnlineClass: def __init__( self, name: str, @@ -16,8 +16,8 @@ def __init__( def from_dict( cls, course_dict: dict - ) -> OnlineCourse: - return OnlineCourse( + ) -> OnlineClass: + return OnlineClass( course_dict.get("name"), course_dict.get("description"), cls.days_to_weeks(course_dict.get("days")) diff --git a/tests/test_main.py b/tests/test_main.py index 7535bf92..a030acf9 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1,9 +1,9 @@ import pytest -from app.main import OnlineCourse +from app.main import OnlineClass -class OnlineClass(OnlineCourse): +class OnlineClass(OnlineClass): pass @@ -16,7 +16,7 @@ class OnlineClass(OnlineCourse): ], ) def test_constructor(name, description, weeks): - course = OnlineCourse(name=name, description=description, weeks=weeks) + course = OnlineClass(name=name, description=description, weeks=weeks) assert course.name == name, ( f"Course should have 'name' equal to {name} " f"when course is created with " @@ -52,7 +52,7 @@ def test_constructor(name, description, weeks): ], ) def test_days_to_weeks(days, weeks): - assert OnlineCourse.days_to_weeks(days) == weeks, ( + assert OnlineClass.days_to_weeks(days) == weeks, ( f"Staticmethod 'days_to_weeks' should return {weeks} " f"when 'days' is equal to {days}" ) @@ -94,7 +94,7 @@ def test_days_to_weeks(days, weeks): ], ) def test_from_dict_method(dictionary, name, description, weeks): - course = OnlineCourse.from_dict(dictionary) + course = OnlineClass.from_dict(dictionary) assert course.name == name, ( f"Course should have 'name' equal to {name} " f"when course is created with "