예제 #1
0
 def test_params_reset_after_get_cik(self, ticker_lookups,
                                     mock_client_cik_lookup,
                                     mock_single_cik_lookup_outside_map):
     lookup = CIKLookup(lookups=ticker_lookups,
                        client=mock_client_cik_lookup)
     lookup._get_cik_from_html(ticker_lookups[0])
     assert lookup.params.get("CIK") is None and lookup.params.get(
         "company") is None
예제 #2
0
 def test_multiple_results_raises_warnings(
         self, mock_client_cik_lookup,
         mock_single_cik_multiple_results_response):
     multiple_results_cik = CIKLookup('paper',
                                      client=mock_client_cik_lookup)
     with pytest.warns(UserWarning):
         _ = multiple_results_cik.ciks
예제 #3
0
 def test_multiple_results_company_name_search(
         self, mock_client_cik_lookup,
         mock_single_cik_multiple_results_response):
     multiple_results_cik = CIKLookup('paper',
                                      client=mock_client_cik_lookup)
     with pytest.warns(UserWarning):
         assert len(multiple_results_cik.ciks) == 0
예제 #4
0
 def test_empty_lookups_raises_type_error(self, bad_lookups):
     with pytest.raises(TypeError):
         CIKLookup(lookups=bad_lookups)
예제 #5
0
 def test_client_property(self, client, ticker_lookups):
     lookup = CIKLookup(ticker_lookups, client=client)
     assert lookup.client == client
예제 #6
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
예제 #7
0
 def test_validate_cik__is_string(self, bad_cik):
     with pytest.raises(TypeError):
         CIKLookup(bad_cik)
예제 #8
0
 def test_cik_lookup_lookups_property(self):
     multiple_company_lookup = CIKLookup(['aapl', 'msft', 'fb'])
     assert multiple_company_lookup.lookups == ['aapl', 'msft', 'fb']
예제 #9
0
 def test_cik_lookup_lookups_property(self, mock_client_cik_lookup):
     multiple_company_lookup = CIKLookup(['aapl', 'msft', 'fb'],
                                         client=mock_client_cik_lookup)
     assert multiple_company_lookup.lookups == ['aapl', 'msft', 'fb']
예제 #10
0
 def test_validate_cik_on_bad_ciks(self, bad_cik):
     with pytest.raises(CIKError):
         CIKLookup._validate_cik(bad_cik)
예제 #11
0
 def test_cik_lookup_cik_hits_request(self):
     with patch.object(CIKLookup, '_get_cik_from_html') as mock:
         CIKLookup(['Apple']).get_ciks()
         mock.assert_called()
예제 #12
0
 def test_lookups_property(self, mock_client_cik_lookup, ticker_lookups):
     lookup = CIKLookup(lookups=ticker_lookups,
                        client=mock_client_cik_lookup)
     assert lookup.lookups == ticker_lookups
예제 #13
0
 def test_bad_lookups_raises_type_error(self, bad_lookups,
                                        mock_client_cik_lookup):
     with pytest.raises(TypeError):
         CIKLookup(lookups=bad_lookups, client=mock_client_cik_lookup)
예제 #14
0
 def test_validate_cik__is_string(self, mock_client_cik_lookup, bad_cik):
     with pytest.raises(TypeError):
         CIKLookup(bad_cik, client=mock_client_cik_lookup)
예제 #15
0
 def test_lookups_property(self, ticker_lookups):
     lookup = CIKLookup(lookups=ticker_lookups)
     assert lookup.lookups == ticker_lookups
예제 #16
0
 def test_cik_lookup_cik_bypasses_request(self):
     with patch.object(CIKLookup, '_get_cik_from_html') as mock:
         CIKLookup(['1018724']).get_ciks()
         mock.assert_not_called()
예제 #17
0
 def test_validate_lookup(self, bad_lookup):
     with pytest.raises(TypeError):
         CIKLookup._validate_lookup(bad_lookup)
예제 #18
0
 def test_cik_lookup_returns_correct_values(self, lookup, expected,
                                            mock_get_cik_map):
     look = CIKLookup(lookup)
     assert look.lookup_dict == expected
예제 #19
0
 def cik_lookup(self, val):
     if not isinstance(val, CIKLookup):
         val = CIKLookup(val)
     self._cik_lookup = val
예제 #20
0
 def test_cik_lookup_returns_correct_values_smoke(self, lookup, expected,
                                                  real_test_client):
     look = CIKLookup(lookup, client=real_test_client)
     assert look.lookup_dict == expected