-
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.
- Loading branch information
Showing
4 changed files
with
291 additions
and
55 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,29 @@ | ||
name: CI | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' # Specify the Python version you want to use | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install . | ||
- name: Run tests | ||
run: | | ||
python -m unittest discover -s . -p "test_*.py" | ||
- name: Run doctests | ||
run: | | ||
python -m doctest utils.py |
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
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,39 @@ | ||
import unittest | ||
import matplotlib.pyplot as plt | ||
from plotting import plot_hipp_surf | ||
|
||
class TestPlotHippSurf(unittest.TestCase): | ||
|
||
def test_invalid_density(self): | ||
with self.assertRaises(ValueError): | ||
plot_hipp_surf(surf_map='dummy_path', density='invalid_density') | ||
|
||
def test_invalid_hemi(self): | ||
with self.assertRaises(ValueError): | ||
plot_hipp_surf(surf_map='dummy_path', hemi='invalid_hemi') | ||
|
||
def test_invalid_space(self): | ||
with self.assertRaises(ValueError): | ||
plot_hipp_surf(surf_map='dummy_path', space='invalid_space') | ||
|
||
def test_plot_creation(self): | ||
fig = plot_hipp_surf(surf_map='dummy_path') | ||
self.assertIsInstance(fig, plt.Figure) | ||
|
||
def test_colorbar(self): | ||
fig = plot_hipp_surf(surf_map='dummy_path', colorbar=True) | ||
self.assertIsInstance(fig, plt.Figure) | ||
self.assertEqual(len(fig.axes), 6) # 5 plots + 1 colorbar | ||
|
||
def test_default_parameters(self): | ||
fig = plot_hipp_surf(surf_map='dummy_path') | ||
self.assertIsInstance(fig, plt.Figure) | ||
self.assertEqual(len(fig.axes), 5) # 5 plots | ||
|
||
def test_custom_parameters(self): | ||
fig = plot_hipp_surf(surf_map='dummy_path', density='1mm', hemi='right', space='canonical', figsize=(10, 6), dpi=200, vmin=0, vmax=1, colorbar=True, colorbar_shrink=0.5, cmap='viridis', view='ventral', avg_method='mean', bg_on_data=False, alpha=0.5, darkness=1) | ||
self.assertIsInstance(fig, plt.Figure) | ||
self.assertEqual(len(fig.axes), 6) # 5 plots + 1 colorbar | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
Oops, something went wrong.