Record of essential html composition (mainly for testing)
This commit is contained in:
@ -5,6 +5,12 @@ from bs4 import BeautifulSoup
|
||||
|
||||
from mwfin import functions
|
||||
|
||||
# boiled down & accurate structure of a relevant data table
|
||||
# https://www.marketwatch.com/investing/stock/aapl/financials/cash-flow
|
||||
# view page source @ line 2055
|
||||
TEST_HTML = ''
|
||||
TEST_SOUP = BeautifulSoup(TEST_HTML, 'html.parser')
|
||||
|
||||
|
||||
class FunctionsTestCase(IsolatedAsyncioTestCase):
|
||||
|
||||
@ -26,19 +32,8 @@ class FunctionsTestCase(IsolatedAsyncioTestCase):
|
||||
self.assertEqual(expected_output, output)
|
||||
|
||||
def test_extract_end_dates(self):
|
||||
test_html = '<tr>' \
|
||||
'<th><div> ITEM </div></th>' \
|
||||
'<th><div> 30-SEP-2020 </div></th>' \
|
||||
'<th><div> 31-DEC-2020 </div></th>' \
|
||||
'<th><div> 31-MAR-2021 </div></th>' \
|
||||
'<th><div> 30-JUN-2021 </div></th>' \
|
||||
'<th><div> 30-SEP-2021 </div></th>' \
|
||||
'</tr>'
|
||||
test_soup = BeautifulSoup(test_html, 'html.parser')
|
||||
|
||||
expected_output = ('30-SEP-2020', '31-DEC-2020', '31-MAR-2021',
|
||||
'30-JUN-2021', '30-SEP-2021')
|
||||
output = functions.extract_end_dates(test_soup)
|
||||
expected_output = ('End_Date_1', 'End_Date_2')
|
||||
output = functions.extract_end_dates(TEST_SOUP)
|
||||
self.assertTupleEqual(expected_output, output)
|
||||
|
||||
def test_find_relevant_table_rows(self):
|
||||
|
Reference in New Issue
Block a user