Skip to content

Commit 15a8a55

Browse files
committed
fixes after review
1 parent 879079e commit 15a8a55

2 files changed

Lines changed: 12 additions & 17 deletions

File tree

tutorial/quiz/object_oriented_programming_advanced.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -148,19 +148,6 @@ def __init__(self, title=""):
148148
)
149149

150150
q5 = Question(
151-
question="Which decorator is used to define a method that belongs to the class rather than an instance?",
152-
options={
153-
"@staticmethod": "Incorrect. A static method does not belong to the class or instance.",
154-
"@classmethod": "Correct! A class method belongs to the class and takes `cls` as its first parameter.",
155-
"@property": "Incorrect. The `@property` decorator is used to define getter methods.",
156-
"@abstractmethod": "Incorrect. The `@abstractmethod` decorator is used in abstract classes.",
157-
},
158-
correct_answer="@classmethod",
159-
hint="This method takes `cls` as its first parameter.",
160-
shuffle=True,
161-
)
162-
163-
q6 = Question(
164151
question="What is the purpose of the `@classmethod` decorator?",
165152
options={
166153
"To define a method that belongs to the class rather than an instance": "Correct! A class method belongs to the class and takes `cls` as its first parameter.",
@@ -173,7 +160,7 @@ def __init__(self, title=""):
173160
shuffle=True,
174161
)
175162

176-
q7 = Question(
163+
q6 = Question(
177164
question="What is the difference between `@staticmethod` and `@classmethod`?",
178165
options={
179166
"`@staticmethod` does not access the class or instance, while `@classmethod` takes `cls` as its first parameter": "Correct! This is the key difference between the two decorators.",
@@ -186,7 +173,7 @@ def __init__(self, title=""):
186173
shuffle=True,
187174
)
188175

189-
super().__init__(questions=[q1, q2, q3, q4, q5, q6, q7])
176+
super().__init__(questions=[q1, q2, q3, q4, q5, q6])
190177

191178

192179
class OopAdvancedEncapsulation(Quiz):

tutorial/tests/test_13_object_oriented_programming_advanced.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,16 @@ def validate_child_eye_color(solution_result):
6161
attrs = list(vars(solution_result))
6262
except TypeError:
6363
raise SubAssertionError from None
64-
assert len(attrs) == 1, "The class should have 1 attribute."
65-
assert "eye_color" in attrs, "The class attribute should be 'eye_color'."
64+
assert len(attrs) == 3, "The class should have 3 attributes."
65+
assert "eye_color" in attrs, (
66+
"The class should have an attribute called 'eye_color'."
67+
)
68+
assert "eye_color_mother" in attrs, (
69+
"The class should have an attribute called 'eye_color_mother'."
70+
)
71+
assert "eye_color_father" in attrs, (
72+
"The class should have an attribute called 'eye_color_father'."
73+
)
6674

6775

6876
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)