starting AnalyzerTest

This commit is contained in:
frankknoll
2023-10-09 11:18:04 +02:00
parent ee381d0757
commit 8aa743a1e6
4 changed files with 43 additions and 0 deletions

1
.gitignore vendored
View File

@@ -16,3 +16,4 @@ src/intensivstationen/__pycache__/
google-chrome-stable_current_amd64*
src/captcha/__pycache__
src/GoogleAnalytics/__pycache__
src/SymptomsCausedByVaccines/__pycache__

View File

@@ -0,0 +1,9 @@
import pandas as pd
class Analyzer:
def __init__(self, symptomByVaccine: pd.DataFrame):
self.symptomByVaccine = symptomByVaccine
def getSymptomsForVaccine(self, vaxType):
return self.symptomByVaccine.loc[vaxType]

View File

@@ -0,0 +1,33 @@
import unittest
from pandas.testing import assert_series_equal
from TestHelper import TestHelper
import pandas as pd
from SymptomsCausedByVaccines.Analyzer import Analyzer
class AnalyzerTest(unittest.TestCase):
# input a vaccine name, and see which symptoms are strongest for it.
def test_getSymptomsForVaccine(self):
# Given
symptomByVaccine = TestHelper.createDataFrame(
columns = ['11-beta-hydroxylase deficiency', '17-hydroxyprogesterone'],
data = [ [0.6, 0.4]],
index = pd.Index(
name = 'VAX_TYPE',
data = ['6VAX-F']))
analyzer = Analyzer(symptomByVaccine)
# When
symptomsForVaccine = analyzer.getSymptomsForVaccine('6VAX-F')
# Then
assert_series_equal(
symptomsForVaccine,
pd.Series(
name = '6VAX-F',
data = {
'11-beta-hydroxylase deficiency': 0.6,
'17-hydroxyprogesterone': 0.4
}))

View File