Skip to content

Commit 72ac966

Browse files
committed
Added more tests to Type Conversion task
1 parent 9ca5a34 commit 72ac966

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Variables/Type conversion/task-info.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ files:
88
placeholder_text: '"convert it to int here"'
99
- name: tests/test_task.py
1010
visible: false
11-
feedback_link: https://docs.google.com/forms/d/e/1FAIpQLSfRlDlldKfuq-cHMNFfHMER61P1PRIan7KG6yp1GvaweDI7GA/viewform?usp=pp_url&entry.2103429047=Variables+/+Type+Conversion
11+
feedback_link: https://docs.google.com/forms/d/e/1FAIpQLSfRlDlldKfuq-cHMNFfHMER61P1PRIan7KG6yp1GvaweDI7GA/viewform?usp=pp_url&entry.2103429047=Variables+/+Type+Conversion

Variables/Type conversion/tests/test_task.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,14 @@ def test_type_conversion(self):
3939
# TODO comeback and switch it to another assert architecture if the render of the text is not fixed in task view
4040
self.assertIs(type(actual_converted_float_number), expected_type, msg="The variable doesn't seem to be an integer "
4141
"yet. Please convert it!")
42+
43+
def test_0_code_len(self):
44+
with open("type_cast.py", "r") as taskfile:
45+
lines = taskfile.readlines()
46+
self.assertTrue(len(lines) == 10, msg="Please do not add or remove any lines from the code file.")
47+
48+
def test_statement_1(self):
49+
with open("type_cast.py", "r") as taskfile:
50+
lines = taskfile.readlines()
51+
code = lines[-3]
52+
self.assertTrue("int(" in code, msg="Your expression does not perform a type conversion.")

0 commit comments

Comments
 (0)