Skip to content

Commit

Permalink
add test and update repo settings
Browse files Browse the repository at this point in the history
  • Loading branch information
yalinli2 committed Dec 6, 2024
1 parent dd90df2 commit 6e2b64a
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ addopts =
--ignore='setup.py'

; temporary
--ignore-glob='exposan/biobinder/**'
--ignore-glob='exposan/saf/**'
--ignore-glob='exposan/biobinder/**'

; private repo due to NDA
--ignore-glob='exposan/new_generator/**'
Expand All @@ -24,6 +23,7 @@ addopts =
--ignore-glob='exposan/pm2_ecorecover/calibration.py'
--ignore-glob='exposan/pm2_ecorecover/data_cleaning.py'
--ignore-glob='exposan/pou_disinfection/analyses/**'
--ignore-glob='exposan/saf/analyses/**'
norecursedirs =
build
dist
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
'pou_disinfection/data/*',
'reclaimer/*',
'reclaimer/data/*',
'saf/*',
'saf/data/*',
]},
classifiers=[
'License :: OSI Approved :: University of Illinois/NCSA Open Source License',
Expand Down
43 changes: 43 additions & 0 deletions tests/test_saf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

'''
EXPOsan: Exposition of sanitation and resource recovery systems
This module is developed by:
Yalin Li <[email protected]>
This module is under the University of Illinois/NCSA Open Source License.
Please refer to https://github.com/QSD-Group/EXPOsan/blob/main/LICENSE.txt
for license details.
'''

__all__ = ('test_saf',)

def test_saf():
from numpy.testing import assert_allclose
from exposan import saf

# Because of different CF settings for ImpactItem with the same ID
from qsdsan.utils import clear_lca_registries
clear_lca_registries()

saf.load(configuration='baseline')
rtol = 0.01
assert_allclose(saf.get_MFSP(saf.sys), 3.95586679600505, rtol=rtol)
assert_allclose(saf.get_GWP(saf.sys), -5.394022805849971, rtol=rtol)

saf.load(configuration='EC')
saf.simulate_and_print(saf.sys)
assert_allclose(saf.get_MFSP(saf.sys), 11.876241988677974, rtol=rtol)
assert_allclose(saf.get_GWP(saf.sys), 2.8357334832704386, rtol=rtol)

saf.load(configuration='EC-Future')
saf.simulate_and_print(saf.sys)
assert_allclose(saf.get_MFSP(saf.sys), 3.821113328378629, rtol=rtol)
assert_allclose(saf.get_GWP(saf.sys), -8.475883955624251, rtol=rtol)


if __name__ == '__main__':
test_saf()

0 comments on commit 6e2b64a

Please sign in to comment.