diff --git a/tests/test_functions.py b/tests/test_functions.py index 348575f..3560138 100644 --- a/tests/test_functions.py +++ b/tests/test_functions.py @@ -45,16 +45,28 @@ class FunctionsTestCase(IsolatedAsyncioTestCase): self.assertTupleEqual(expected_output, output) def test_find_relevant_table_rows(self): - pass + test_table = self.test_soup.find('div', attrs={'class': 'financials'}).div.div.table + expected_output = [test_table.thead.tr, test_table.tbody.tr] + # print(expected_output) # debug + output = functions.find_relevant_table_rows(self.test_soup) + self.assertListEqual(expected_output, output) def test_convert_number(self): + # likely not necessary if data-chart-data is used + # e.g. floats may be converted on extraction pass def test_extract_row_data(self): - pass + test_table = self.test_soup.find('div', attrs={'class': 'financials'}).div.div.table + expected_output = ('Item_1', (11000000.0, -22000000.0)) + output = functions.extract_row_data(test_table.tbody.tr) + # print(test_table.tbody.tr) # debug + self.assertTupleEqual(expected_output, output) def test_extract_all_data(self): - pass + expected_output = {'Item_1': (11000000.0, -22000000.0)} + output = functions.extract_row_data(self.test_soup) + self.assertDictEqual(expected_output, output) async def test_get_balance_sheet(self): pass diff --git a/tests/test_structure.html b/tests/test_structure.html index 7f2d47a..b0b7ce5 100644 --- a/tests/test_structure.html +++ b/tests/test_structure.html @@ -13,28 +13,28 @@
'Item' 'Item' |
- End_Date_1 |
- End_Date_2 |
- - |
---|---|---|---|
Item_1 Item_1 |
- - | - | |
Item_2 Item_2 |
- - | - | - |
!!Item !!Item |
+ End_Date_1 |
+ End_Date_2 |
+ + |
Item_1 Item_1 |
+ + | + | |
Item_2 Item_2 |
+ + | + | + |