Skip to content

Commit

Permalink
src structure + tests + gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
RemDelaporteMathurin committed Oct 29, 2024
1 parent 4b8940d commit 50e1f78
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 0 deletions.
112 changes: 112 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

# version file
**_version.py

# Input/Output files
*.bp
*.xdmf
*.h5
1 change: 1 addition & 0 deletions src/hisp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .helpers import PulsedSource, Scenario
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions test/test_scenario.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from hisp.helpers import Scenario
import os
import pytest

current_dir = os.path.dirname(__file__)
scenario_path = os.path.join(current_dir, "scenario_test.txt")


def test_maximum_time():
# BUILD
my_scenario = Scenario(scenario_path)
expected_maximum_time = 2 * (455 + 455 + 650 + 1000) + 2 * (36 + 36 + 180 + 1000)

# RUN
computed_maximum_time = my_scenario.get_maximum_time()

# TEST
assert computed_maximum_time == expected_maximum_time


@pytest.mark.parametrize("t, expected_row", [(0, 0), (6000, 1)])
def test_get_pulse_row(t, expected_row):
my_scenario = Scenario(scenario_path)

pulse_row = my_scenario.get_row(t=t)

assert pulse_row == expected_row

0 comments on commit 50e1f78

Please sign in to comment.