# Print Function Tests

This is an example of how you can test the output stream of a student defined function.&#x20;

This test makes sure the student's function named `print_hello()` prints `"Hello World"`.  It assumes the student's file name is `example.py`.  Replace the import with whatever you student's file name is.&#x20;

*Note:  This code converts the output to all lowercase and removes spaces to compare against the correct value.*

#### **Grading Tests:**

```python
import unittest
import sys, io

class CodingRoomsUnitTests(unittest.TestCase):

    def test_default_case(self):
        stdout = sys.stdout
        sys.stdout = io.StringIO()
        import example
        example.print_hello()
        output = sys.stdout.getvalue().strip("\n")
        sys.stdout = stdout
        answer = "Hello World".casefold().replace(" ", "")
        student = output.casefold().replace(" ", "")
        self.assertEqual(answer, student)

if __name__ == '__main__':
    unittest.main()
```

#### Sample Solution:

{% code title="example.py" %}

```python
def print_hello():
    print("Hello World")
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://auto-grade.joemazzone.net/python/print-functions-tests.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
