mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-12-27 09:59:10 +00:00
Merge pull request #22 from titanscout2022/master
Reflect master to master-staged
This commit is contained in:
commit
df046d4806
38
.github/workflows/ut-analysis.yml
vendored
Normal file
38
.github/workflows/ut-analysis.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
|
||||||
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
||||||
|
|
||||||
|
name: Analysis Unit Tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: [3.7, 3.8]
|
||||||
|
|
||||||
|
env:
|
||||||
|
working-directory: ./analysis-master/
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install pytest
|
||||||
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||||
|
working-directory: ${{ env.working-directory }}
|
||||||
|
- name: Test with pytest
|
||||||
|
run: |
|
||||||
|
pytest
|
||||||
|
working-directory: ${{ env.working-directory }}
|
38
.github/workflows/ut-superscript.yml
vendored
Normal file
38
.github/workflows/ut-superscript.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
|
||||||
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
||||||
|
|
||||||
|
name: Superscript Unit Tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: [3.7, 3.8]
|
||||||
|
|
||||||
|
env:
|
||||||
|
working-directory: ./data-analysis/
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install pytest
|
||||||
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||||
|
working-directory: ${{ env.working-directory }}
|
||||||
|
- name: Test with pytest
|
||||||
|
run: |
|
||||||
|
pytest
|
||||||
|
working-directory: ${{ env.working-directory }}
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -26,3 +26,5 @@ analysis-master/analysis.egg-info/
|
|||||||
analysis-master/build/
|
analysis-master/build/
|
||||||
analysis-master/metrics/
|
analysis-master/metrics/
|
||||||
data-analysis/config-pop.json
|
data-analysis/config-pop.json
|
||||||
|
analysis-master/__pycache__/
|
||||||
|
analysis-master/.pytest_cache/
|
17
analysis-master/test_analysis.py
Normal file
17
analysis-master/test_analysis.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
from analysis import analysis as an
|
||||||
|
|
||||||
|
def test_():
|
||||||
|
test_data_linear = [1, 3, 6, 7, 9]
|
||||||
|
y_data_ccu = [1, 3, 7, 14, 21]
|
||||||
|
y_data_ccd = [1, 5, 7, 8.5, 8.66]
|
||||||
|
assert an.basic_stats(test_data_linear) == {"mean": 5.2, "median": 6.0, "standard-deviation": 2.85657137141714, "variance": 8.16, "minimum": 1.0, "maximum": 9.0}
|
||||||
|
assert an.z_score(3.2, 6, 1.5) == -1.8666666666666665
|
||||||
|
assert an.z_normalize(test_data_linear).tolist() == [5.2, 6.0, 2.85657137141714, 8.16, 1.0, 9.0]
|
||||||
|
assert all(isinstance(item, str) for item in an.regression(test_data_linear, y_data_ccu, ["lin"])) == True
|
||||||
|
assert all(isinstance(item, str) for item in an.regression(test_data_linear, y_data_ccd, ["log"])) == True
|
||||||
|
assert all(isinstance(item, str) for item in an.regression(test_data_linear, y_data_ccu, ["exp"])) == True
|
||||||
|
assert all(isinstance(item, str) for item in an.regression(test_data_linear, y_data_ccu, ["ply"])) == True
|
||||||
|
assert all(isinstance(item, str) for item in an.regression(test_data_linear, y_data_ccd, ["sig"])) == True
|
||||||
|
assert an.Metric().elo(1500, 1500, [1, 0], 400, 24) == 1512.0
|
||||||
|
assert an.Metric().glicko2(1500, 250, 0.06, [1500, 1400], [250, 240], [1, 0]) == (1478.864307445517, 195.99122679202452, 0.05999602937563585)
|
||||||
|
assert an.Metric().trueskill([[(25, 8.33), (24, 8.25), (32, 7.5)], [(25, 8.33), (25, 8.33), (21, 6.5)]], [1, 0]) == [(an.metrics.trueskill.Rating(mu=21.346, sigma=7.875), an.metrics.trueskill.Rating(mu=20.415, sigma=7.808), an.metrics.trueskill.Rating(mu=29.037, sigma=7.170)), (an.metrics.trueskill.Rating(mu=28.654, sigma=7.875), an.metrics.trueskill.Rating(mu=28.654, sigma=7.875), an.metrics.trueskill.Rating(mu=23.225, sigma=6.287))]
|
2
data-analysis/test_superscript.py
Normal file
2
data-analysis/test_superscript.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
def test_():
|
||||||
|
assert 1 == 1
|
Loading…
Reference in New Issue
Block a user