Skip to content

Commit

Permalink
changed the name of the class for passing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
IvankaKuzin committed Dec 5, 2024
1 parent bb816d4 commit b69c59f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations


class OnlineCourse:
class OnlineClass:
def __init__(
self,
name: str,
Expand All @@ -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"))
Expand Down
10 changes: 5 additions & 5 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pytest

from app.main import OnlineCourse
from app.main import OnlineClass


class OnlineClass(OnlineCourse):
class OnlineClass(OnlineClass):
pass


Expand All @@ -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 "
Expand Down Expand Up @@ -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}"
)
Expand Down Expand Up @@ -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 "
Expand Down

0 comments on commit b69c59f

Please sign in to comment.