def test_GOOG_shareholders_equity(self): sec_value = 994.77 doc_path = tests.asset_file_path('goog-20120630.xml') xbrl_document = XBRLDocument.gets_XBRL_locally(file_path=doc_path) filing = Filing(filing_date=None, document=xbrl_document, next_filing=None) book_value_per_share = BookValuePerShare.value_from_filing(filing) self.assertAlmostEqual(book_value_per_share, sec_value, places=1)
def test_document_downloading(self): url = 'http://www.sec.gov/Archives/edgar/data/320193/000119312513022339/aapl-20121229.xml' test_filing_path = tests.asset_file_path('aapl-20121229.xml') with open(test_filing_path) as f: test_statement_xml_dict = xmltodict.parse(f.read()) xbrl_dict = test_statement_xml_dict['xbrl'] doc = XBRLDocument.gets_XBRL_from_edgar(xbrl_url=url) self.assertDictEqual(doc._xbrl_dict, xbrl_dict)
def test_appl(self): '''value computed from http://www.sec.gov/cgi-bin/viewer?action=view&cik=320193&accession_number=0001193125-13-022339&xbrl_type=v#. ''' sec_value = 135.6 doc_path = tests.asset_file_path('aapl-20121229.xml') xbrl_document = XBRLDocument.gets_XBRL_locally(file_path=doc_path) filing = Filing(filing_date=None, document=xbrl_document, next_filing=None) book_value_per_share = BookValuePerShare.value_from_filing(filing) self.assertAlmostEqual(book_value_per_share, sec_value, places=1)
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(tests.asset_file_path('abbv_search_results.html')) as test_html: text.return_value = test_html.read() ticker = 'ABBV' urls = edgar._get_document_page_urls(symbol=ticker, filing_type='10-Q') self.assertFalse(list(urls)) filing_type = '10-Q' filings = edgar.get_filings(symbol=ticker, filing_type=filing_type) self.assertEqual(len(filings), 0)
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(tests.asset_file_path( 'abbv_search_results.html')) as test_html: text.return_value = test_html.read() ticker = 'ABBV' urls = edgar._get_document_page_urls(symbol=ticker, filing_type='10-Q') self.assertFalse(list(urls)) filing_type = '10-Q' filings = edgar.get_filings(symbol=ticker, filing_type=filing_type) self.assertEqual(len(filings), 0)
def setUp(self): test_filing_path = tests.asset_file_path('aapl-20121229.xml') self.xbrl_doc = XBRLDocument.gets_XBRL_locally(file_path=test_filing_path)