-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #138 from ryansurf/more_tests
more tests!
- Loading branch information
Showing
3 changed files
with
74 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
""" | ||
QA tests for art.py | ||
Make sure pytest is installed: pip install pytest | ||
Run pytest: pytest | ||
""" | ||
|
||
import io | ||
import sys | ||
|
||
from src import art | ||
|
||
|
||
def test_print_wave(): | ||
""" | ||
Testing the print_wave() function | ||
Uses sys & io to capture printed output | ||
""" | ||
# Capture the output | ||
captured_output = io.StringIO() # Create StringIO object | ||
sys.stdout = captured_output # Redirect stdout. | ||
|
||
# Call the function | ||
# Color is invalid, should default to blue | ||
art.print_wave(1, 0, "sdfsd") | ||
|
||
# Reset redirect. | ||
sys.stdout = sys.__stdout__ | ||
|
||
# Now captured_output.getvalue() contains the printed content | ||
output = captured_output.getvalue() | ||
|
||
# Perform assertions based on expected output | ||
assert "[0;34m" in output, "Blue color code not found in output" | ||
assert output, "print_wave() did not print anything" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
""" | ||
QA tests for gpt.py | ||
Make sure pytest is installed: pip install pytest | ||
Run pytest: pytest | ||
""" | ||
|
||
from src import gpt | ||
|
||
|
||
def test_simple_gpt(): | ||
""" | ||
Testing the simple_gpt function | ||
Calls the simple gpt and asks it to output | ||
"gpt works". If anything else is outputted, we can | ||
assume an error has occured | ||
""" | ||
surf_summary = "Please only output: 'gpt works!' " | ||
gpt_prompt = "This is for testing purposes" | ||
gpt_response = gpt.simple_gpt(surf_summary, gpt_prompt) | ||
assert "gpt works" in gpt_response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters