more unit tests

This commit is contained in:
Maximilian Fajnberg 2021-11-24 15:28:34 +01:00
parent d504ddfc33
commit 8041386d52
2 changed files with 37 additions and 25 deletions

View File

@ -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

View File

@ -13,28 +13,28 @@
<div>
<div>
<table>
<thead>
<tr>
<th><div> 'Item' </div><div> 'Item' </div></th>
<th><div> End_Date_1 </div></th>
<th><div> End_Date_2 </div></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><div> Item_1 </div><div> Item_1 </div></td>
<td></td>
<td></td>
<td><div> <div data-chart-data="11000000.0,-22000000.0"><div></div></td>
</tr>
<tr>
<td><div> Item_2 </div><div> Item_2 </div></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
<thead>
<tr>
<th><div> !!Item </div><div> !!Item </div></th>
<th><div> End_Date_1 </div></th>
<th><div> End_Date_2 </div></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><div> Item_1 </div><div> Item_1 </div></td>
<td></td>
<td></td>
<td><div> <div data-chart-data="11000000.0,-22000000.0"><div></div></td>
</tr>
<tr>
<td><div> Item_2 </div><div> Item_2 </div></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>