Skip to content

Commit

Permalink
πŸ‘¨β€πŸ”¬ Create 1st test with pytest.
Browse files Browse the repository at this point in the history
  • Loading branch information
Orel138 committed Feb 6, 2024
1 parent 164352c commit 8557142
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python3
import sys
from pathlib import Path
import pytest
from unittest.mock import patch

sys.path.append(str(Path(__file__).parent.parent / 'lego_cli'))

from lego_cli.main import LegoCLI

# Test to verify the analyze_lego_data method with a mock
@patch('matplotlib.pyplot.show')
@patch('lego_cli.main.analyze_by_theme')
def test_analyze_lego_data(mock_analyze, mock_show):
cli = LegoCLI()
cli.option.analyze_by_theme = True
cli.option.csv_path = 'tests/Brickset-MySets-all.csv'
cli.option.theme = 'Star Wars'
cli.option.subtheme = 'Episode IV'
cli.analyze_lego_data()
mock_analyze.assert_called_once_with(
'tests/Brickset-MySets-all.csv',
'Star Wars',
'Episode IV'
)

0 comments on commit 8557142

Please sign in to comment.