plan to encode row indentation as int & include it as the 1st element in the data tuple

This commit is contained in:
Maximilian Fajnberg 2021-12-26 18:08:25 +01:00
parent c93fb9692e
commit f7cb5de928
2 changed files with 28 additions and 7 deletions

View File

@ -63,7 +63,7 @@ class FunctionsTestCase(IsolatedAsyncioTestCase):
def test_extract_row_data(self):
test_row = self.test_soup.find('div', attrs={'class': 'financials'}).tbody.tr
expected_output = ('foo', (1., -2.))
expected_output = ('foo', (1, 1., -2.))
output = functions.extract_row_data(test_row)
self.assertTupleEqual(expected_output, output)
@ -197,9 +197,24 @@ class FunctionsTestCase(IsolatedAsyncioTestCase):
symbol = 'foo'
# Since the web request is mocked we always receive the same HTML markup.
expected_output = {
BS: {END_DATE: ('End_Date_1', 'End_Date_2'), 'foo': (1., -2.), 'bar': (2., -3.)},
IS: {END_DATE: ('End_Date_1', 'End_Date_2'), 'foo': (1., -2.), 'bar': (2., -3.)},
CF: {END_DATE: ('End_Date_1', 'End_Date_2'), 'foo': (1., -2.), 'bar': (2., -3.)}
BS: {
END_DATE: ('End_Date_1', 'End_Date_2'),
'foo': (1, 1., -2.),
'bar': (2, 2., -3.),
'baz': (3, 3., -4.)
},
IS: {
END_DATE: ('End_Date_1', 'End_Date_2'),
'foo': (1, 1., -2.),
'bar': (2, 2., -3.),
'baz': (3, 3., -4.)
},
CF: {
END_DATE: ('End_Date_1', 'End_Date_2'),
'foo': (1, 1., -2.),
'bar': (2, 2., -3.),
'baz': (3, 3., -4.)
}
}
output = await functions.get_all_financials(symbol, session=mock_session_obj)
self.assertDictEqual(expected_output, output)

View File

@ -15,7 +15,7 @@
<table>
<thead>
<tr>
<th><div> !!Item </div><div> !!Item </div></th>
<th><div class="xyz abc"> !!Item </div><div> !!Item </div></th>
<th><div> End_Date_1 </div></th>
<th><div> End_Date_2 </div></th>
<th></th>
@ -23,17 +23,23 @@
</thead>
<tbody>
<tr>
<td><div> foo </div><div> foo </div></td>
<td><div class="xyz indent--small"> foo </div><div> foo </div></td>
<td></td>
<td></td>
<td><div> <div data-chart-data="1.0,-2.0"><div></div></td>
</tr>
<tr>
<td><div> bar </div><div> bar </div></td>
<td><div class="xyz indent--medium"> bar </div><div> bar </div></td>
<td></td>
<td></td>
<td><div> <div data-chart-data="2.0,-3.0"><div></div></td>
</tr>
<tr>
<td><div class="xyz indent--large"> baz </div><div> baz </div></td>
<td></td>
<td></td>
<td><div> <div data-chart-data="3.0,-4.0"><div></div></td>
</tr>
</tbody>
</table>
</div>