Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 4
0
 def test_empty_lookups_raises_type_error(self, bad_lookups):
     with pytest.raises(TypeError):
         CIKLookup(lookups=bad_lookups)
Exemplo n.º 5
0
 def test_client_property(self, client, ticker_lookups):
     lookup = CIKLookup(ticker_lookups, client=client)
     assert lookup.client == client
Exemplo n.º 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
Exemplo n.º 7
0
 def test_validate_cik__is_string(self, bad_cik):
     with pytest.raises(TypeError):
         CIKLookup(bad_cik)
Exemplo n.º 8
0
 def test_cik_lookup_lookups_property(self):
     multiple_company_lookup = CIKLookup(['aapl', 'msft', 'fb'])
     assert multiple_company_lookup.lookups == ['aapl', 'msft', 'fb']
Exemplo n.º 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']
Exemplo n.º 10
0
 def test_validate_cik_on_bad_ciks(self, bad_cik):
     with pytest.raises(CIKError):
         CIKLookup._validate_cik(bad_cik)
Exemplo n.º 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()
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 15
0
 def test_lookups_property(self, ticker_lookups):
     lookup = CIKLookup(lookups=ticker_lookups)
     assert lookup.lookups == ticker_lookups
Exemplo n.º 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()
Exemplo n.º 17
0
 def test_validate_lookup(self, bad_lookup):
     with pytest.raises(TypeError):
         CIKLookup._validate_lookup(bad_lookup)
Exemplo n.º 18
0
 def test_cik_lookup_returns_correct_values(self, lookup, expected,
                                            mock_get_cik_map):
     look = CIKLookup(lookup)
     assert look.lookup_dict == expected
Exemplo n.º 19
0
 def cik_lookup(self, val):
     if not isinstance(val, CIKLookup):
         val = CIKLookup(val)
     self._cik_lookup = val
Exemplo n.º 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