Editor settings

General settings

Save settings

Content contribution guide

Test case version 2 #

To implement test cases version 2, each test case is a list item with an integer as an id.

For example, this is the code that populates the test cases in this lesson:

<ul>
<li id="test-1"><code>convert_to_title("hello world!")</code> should return <code>"Hello World!"</code>.</li>
<li id="test-2"><code>convert_to_title("the cat in the hat.")</code> should return <code>"The Cat In The Hat."</code>.</li>
<li id="test-3"><code>convert_to_title("i love coding.")</code> should return <code>"I Love Coding."</code>.</li>
<li id="test-4"><code>convert_to_title("this is a test sentence.")</code> should return <code>"This Is A Test Sentence."</code>.</li>
<li id="test-5"><code>convert_to_title("the quick brown fox.")</code> should return <code>"The Quick Brown Fox."</code>.</li>
</ul>

Which generates below list

  • convert_to_title("hello world!") should return "Hello World!".
  • convert_to_title("the cat in the hat.") should return "The Cat In The Hat.".
  • convert_to_title("i love coding.") should return "I Love Coding.".
  • convert_to_title("this is a test sentence.") should return "This Is A Test Sentence.".
  • convert_to_title("the quick brown fox.") should return "The Quick Brown Fox.".

To implement a test script, in the main file group, create a file with the value "is test file" checked. The script should write a JSON oject to the output with the indexes being the number of the test id, and the value being boolean type as the test result. For example:

{
    1: true,
    2: false,
}

To see the test file for this lesson, see the file test.py in the code editor.

Output will be displayed here