Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansurf committed Aug 21, 2024
1 parent 63319c7 commit 03a1de2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
14 changes: 8 additions & 6 deletions tests/test_art.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,29 @@
Run pytest: pytest
"""

import sys
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.
captured_output = io.StringIO() # Create StringIO object
sys.stdout = captured_output # Redirect stdout.

# Call the function
art.print_wave(1, 0, "blue")

# Reset redirect.
sys.stdout = sys.__stdout__
sys.stdout = sys.__stdout__

# Now captured_output.getvalue() contains the printed content
output = captured_output.getvalue()

# Perform assertions based on expected output
assert output != "", "print_wave() did not print anything"
assert output
1 change: 1 addition & 0 deletions tests/test_gpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from src import gpt


def test_simple_gpt():
"""
Testing the simple_gpt function
Expand Down
8 changes: 3 additions & 5 deletions tests/test_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
import io
from unittest.mock import patch

from src import cli
from src import helper
from src import cli, helper


def test_invalid_input():
Expand Down Expand Up @@ -44,6 +43,7 @@ def test_json_output():
assert type(json_output["Lat"]) in {int, float}
assert isinstance(json_output["Location"], str)


def test_print_gpt():
"""
Tests the simple_gpt()
Expand All @@ -53,11 +53,9 @@ def test_print_gpt():
"Height": "test",
"Swell Direction": "test",
"Period": "test",
"Unit": "test"
"Unit": "test",
}
gpt_prompt = "Please output 'gpt works'"
gpt_info = [None, ""]
gpt_response = helper.print_gpt(surf_data, gpt_prompt, gpt_info)
assert "gpt works" in gpt_response


0 comments on commit 03a1de2

Please sign in to comment.