starting PrrByVaccineBySymptomTransformerTest

This commit is contained in:
frankknoll
2023-10-11 18:02:18 +02:00
parent 9d51ef94e7
commit b844a78613
3 changed files with 66 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
class PrrByVaccineBySymptomTransformer:
@staticmethod
def removeNonZeroPrrs(prrByVaccineBySymptom):
return prrByVaccineBySymptom.map(
lambda prrByVaccine: {vaccine: prr for vaccine, prr in prrByVaccine.items() if prr != 0})

View File

@@ -0,0 +1,26 @@
import unittest
from pandas.testing import assert_series_equal
import pandas as pd
from SymptomsCausedByVaccines.PrrByVaccineBySymptomTransformer import PrrByVaccineBySymptomTransformer
class PrrByVaccineBySymptomTransformerTest(unittest.TestCase):
def test_filterByNonZeroPrrs(self):
# Given
prrByVaccineBySymptom = pd.Series(
{
'11-beta-hydroxylase deficiency': {'6VAX-F': 0.0, 'ADEN': 0.3},
'17-hydroxyprogesterone': {'6VAX-F': 1.5, 'ADEN': 0.0}
})
# When
prrByVaccineBySymptomWithoutZeroPrrs = PrrByVaccineBySymptomTransformer.removeNonZeroPrrs(prrByVaccineBySymptom)
# Then
assert_series_equal(
prrByVaccineBySymptomWithoutZeroPrrs,
pd.Series(
{
'11-beta-hydroxylase deficiency': {'ADEN': 0.3},
'17-hydroxyprogesterone': {'6VAX-F': 1.5}
}))