-
Notifications
You must be signed in to change notification settings - Fork 25
/
HistogramDescriptionTableSelectorTest.py
51 lines (46 loc) · 2.1 KB
/
HistogramDescriptionTableSelectorTest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import unittest
from pandas.testing import assert_frame_equal
from HistogramDescriptionTableSelector import HistogramDescriptionTableSelector
from TestHelper import TestHelper
import pandas as pd
class HistogramDescriptionTableSelectorTest(unittest.TestCase):
def test_selectHistogramsWithShortestBatchcodeCombinations(self):
# Given
histogramDescriptionTable = TestHelper.createDataFrame(
columns = ['HISTOGRAM_DESCRIPTION'],
data = [ [
{
"batchcode": "1808982",
"histograms": [
{
"batchcodes": ["1808982", "EW0175", "FD1921"],
"histogram": {"Blood pressure orthostatic abnormal": 5, "Chest discomfort": 1}
},
{
"batchcodes": ["015M20A", "1808982"],
"histogram": {"Chest discomfort": 2}
}
]
}
]
],
index = pd.Index(
name = 'VAX_LOT',
data = ['1808982']))
# When
histogramsWithShortestBatchcodeCombinationsTable = HistogramDescriptionTableSelector.selectHistogramsWithShortestBatchcodeCombinations(histogramDescriptionTable)
# Then
assert_frame_equal(
histogramsWithShortestBatchcodeCombinationsTable,
TestHelper.createDataFrame(
columns = ['HISTOGRAM_DESCRIPTION'],
data = [ [
{
"batchcode": "1808982",
"histogram": {"Chest discomfort": 2}
}
]
],
index = pd.Index(
name = 'VAX_LOT',
data = ['1808982'])))