def test_get_filiing(self): filing = HTMLEdgarDriver.get_filing(ticker='aapl', filing_type='10-Q', date_after=date(2013, 1, 24) ) self.assertEqual(urlparse.urlsplit(filing._document._xbrl_url).path.split('/')[-1], 'aapl-20120630.xml')
def test_get_filiing(self): filing = HTMLEdgarDriver.get_filing(ticker='aapl', filing_type='10-Q', date_after=date(2013, 1, 24)) self.assertEqual( urlparse.urlsplit(filing._document._xbrl_url).path.split('/')[-1], 'aapl-20120630.xml')
def test_mmm(self): '''This was getting a text file instead of xml. ''' filing = HTMLEdgarDriver.get_filing(ticker='MMM', filing_type='10-Q', date_after=date(2010, 1, 04)) self.assertTrue(filing._document._xbrl_url.endswith('.xml'))
def test_ABBV(self, text): '''Test page with no 10-Q's, downloaded 2013-3-2, ABBV had just been spun off or something. ''' with open(os.path.join(TEST_DOCS_DIR, 'abbv_search_results.html')) as test_html: text.return_value = test_html.read() ticker = 'ABBV' self.assertFalse(list(HTMLEdgarDriver._get_document_page_urls(symbol=ticker, filing_type='10-Q') ) ) filing_type = '10-Q' date_after = date(2013, 1, 2) finds_no_filings = lambda : HTMLEdgarDriver.get_filing(ticker, filing_type, date_after, ) self.assertRaises(NoFilingsNotAvailable, finds_no_filings)
def test_ABBV(self, text): '''Test page with no 10-Q's, downloaded 2013-3-2, ABBV had just been spun off or something. ''' with open(os.path.join(TEST_DOCS_DIR, 'abbv_search_results.html')) as test_html: text.return_value = test_html.read() ticker = 'ABBV' self.assertFalse( list( HTMLEdgarDriver._get_document_page_urls(symbol=ticker, filing_type='10-Q'))) filing_type = '10-Q' date_after = date(2013, 1, 2) finds_no_filings = lambda: HTMLEdgarDriver.get_filing( ticker, filing_type, date_after, ) self.assertRaises(XBRLNotAvailable, finds_no_filings)