-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π¨βπ¬ Create 1st test with pytest.
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 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,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' | ||
) |