示例#1
0
 def test_validate_cik_after_cik_lookup(self, monkeypatch):
     # string remains unchecked until query to allow for possibility of
     # using company name, ticker, or CIK as string
     monkeypatch.setattr(NetworkClient, "get_response",
                         MockSingleCIKNotFound)
     with pytest.raises(EDGARQueryError):
         _ = CIKLookup('0notvalid0').ciks
示例#2
0
 def test_filing_get_urls_returns_single_list_of_urls(self, monkeypatch):
     monkeypatch.setattr(_CIKValidator, "get_ciks", MockCIKValidatorMultipleCIKs.get_ciks)
     # Use same response for each request
     monkeypatch.setattr(NetworkClient, "get_response", MockSingleCIKFiling)
     ciks = CIKLookup(['aapl', 'msft', 'amzn'])
     f = Filing(ciks, FilingType.FILING_10Q, count=3)
     assert all(len(f.get_urls().get(key)) == 3 for key in f.get_urls().keys())
示例#3
0
 def test_validate_cik__is_string(self, bad_cik):
     with pytest.raises(TypeError):
         CIKLookup(bad_cik)
示例#4
0
 def test_multiple_results_raises_warnings(
         self, mock_single_cik_multiple_results_response):
     multiple_results_cik = CIKLookup('paper')
     with pytest.warns(UserWarning):
         _ = multiple_results_cik.ciks
示例#5
0
 def test_multiple_results_company_name_search(
         self, mock_single_cik_multiple_results_response):
     multiple_results_cik = CIKLookup('paper')
     with pytest.warns(UserWarning):
         assert len(multiple_results_cik.ciks) == 0
示例#6
0
 def test_cik_lookup_lookups_property(self):
     multiple_company_lookup = CIKLookup(['aapl', 'msft', 'fb'])
     assert multiple_company_lookup.lookups == ['aapl', 'msft', 'fb']
示例#7
0
 def test_cik_lookup_returns_correct_values(self, lookup, expected,
                                            mock_get_cik_map):
     look = CIKLookup(lookup)
     assert look.lookup_dict == expected
示例#8
0
 def test_validate_cik_after_cik_lookup(self, mock_single_cik_not_found):
     # string remains unchecked until query to allow for possibility of
     # using company name, ticker, or CIK as string
     with pytest.raises(EDGARQueryError):
         _ = CIKLookup('0notvalid0').ciks
示例#9
0
 def test_multiple_results_raises_warnings(self, monkeypatch):
     multiple_results_cik = CIKLookup('paper')
     monkeypatch.setattr(NetworkClient, "get_response",
                         MockSingleCIKMultipleResultsResponse)
     with pytest.warns(UserWarning):
         _ = multiple_results_cik.ciks
示例#10
0
 def test_multiple_results_company_name_search(self, monkeypatch):
     multiple_results_cik = CIKLookup('paper')
     monkeypatch.setattr(NetworkClient, "get_response",
                         MockSingleCIKMultipleResultsResponse)
     with pytest.warns(UserWarning):
         assert len(multiple_results_cik.ciks) == 0
示例#11
0
 def test_cik_lookup_returns_correct_values(self, monkeypatch):
     aapl = CIKLookup('aapl')
     monkeypatch.setattr(NetworkClient, "get_response",
                         MockSingleCIKLookupResponse)
     assert aapl.ciks == ['0000320193']
示例#12
0
 def test_cik_lookup_returns_correct_values(
         self, mock_single_cik_lookup_response):
     aapl = CIKLookup('aapl')
     assert aapl.ciks == ['0000320193']
示例#13
0
# https://github.com/coyo8/sec-edgar
# pip install secedgar
from secedgar.filings import CIKLookup, Filing, FilingType

lookup = '0000320193'
lookups = CIKLookup(['aapl', 'msft', 'Facebook'])

my_filings = Filing(cik_lookup=lookup, filing_type=FilingType.FILING_10Q)

my_filings.save('tempdir')
示例#14
0
 def test_validate_cik__is_string(self, bad_cik, expected):
     # float and int not accepted, raising TypeError
     with expected:
         CIKLookup(bad_cik)