-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #245 from gipert/tests
Unit tests cleanup
- Loading branch information
Showing
30 changed files
with
235 additions
and
239 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 |
---|---|---|
@@ -1,12 +1,17 @@ | ||
#!/bin/bash | ||
|
||
pyver=$(python --version | sed 's|Python \([0-9]*\).\([0-9]*\).[0-9]*|\1\2|') | ||
[[ -f /etc/os-release ]] && linux_distro=$(awk -F= '/^NAME/{print $2}' /etc/os-release | cut -d ' ' -f1) | ||
|
||
if [ "$pyver" -gt "35" ]; then | ||
sudo apt-get install -y llvm | ||
else | ||
sudo apt-get install -y llvm-8 | ||
sudo ln -s /usr/bin/llvm-config-8 /usr/bin/llvm-config | ||
if [[ "${linux_distro}" == "Ubuntu" || "${linux_distro}" == "Debian" ]]; then | ||
|
||
pyver=$(python --version | sed 's|Python \([0-9]*\).\([0-9]*\).[0-9]*|\1\2|') | ||
|
||
if [ "$pyver" -gt "35" ]; then | ||
sudo apt-get install -y llvm | ||
else | ||
sudo apt-get install -y llvm-8 | ||
sudo ln -s /usr/bin/llvm-config-8 /usr/bin/llvm-config | ||
fi | ||
fi | ||
|
||
python -m pip install --upgrade pip wheel setuptools numpy GitPython pytest |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,3 @@ | ||
""" | ||
Subpackage documentation | ||
""" |
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,3 @@ | ||
""" | ||
Subpackage documentation | ||
""" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,7 @@ | ||
[pytest] | ||
minversion = 6.0 | ||
addopts = -ra --showlocals --strict-markers --strict-config | ||
xfail_strict = true | ||
filterwarnings = error | ||
log_cli_level = info | ||
testpaths = tests |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 @@ | ||
|
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 @@ | ||
|
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 @@ | ||
|
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,38 @@ | ||
import pygama.lgdo.lgdo_utils as lgdo_utils | ||
import numpy as np | ||
|
||
|
||
def test_get_element_type(): | ||
|
||
objs = [ | ||
('hi', 'string'), | ||
(True, 'bool'), | ||
(np.void(0), 'blob'), | ||
(int(0), 'real'), | ||
(np.uint8(0), 'real'), | ||
(float(0), 'real'), | ||
(1+1j, 'complex'), | ||
(b'hi', 'string'), | ||
(np.array(['hi']), 'string'), | ||
] | ||
|
||
for obj, name in objs: | ||
get_name = lgdo_utils.get_element_type(obj) | ||
assert get_name == name | ||
|
||
|
||
def test_parse_datatype(): | ||
|
||
datatypes = [ | ||
('real', ('scalar', None, 'real')), | ||
('array<1>{bool}', ('array', (1,), 'bool')), | ||
('fixedsizearray<2>{real}', ('fixedsizearray', (2,), 'real')), | ||
('arrayofequalsizedarrays<3,4>{complex}', ('arrayofequalsizedarrays', (3, 4), 'complex')), | ||
('array<1>{array<1>{blob}}', ('array', (1,), 'array<1>{blob}')), | ||
('struct{field1,field2,fieldn}', ('struct', None, ['field1', 'field2', 'fieldn'])), | ||
('table{col1,col2,coln}', ('table', None, ['col1', 'col2', 'coln'])), | ||
] | ||
|
||
for string, dt_tuple in datatypes: | ||
pd_dt_tuple = lgdo_utils.parse_datatype(string) | ||
assert pd_dt_tuple == dt_tuple |
Oops, something went wrong.