mirror of
https://github.com/hydrosquall/tiingo-python.git
synced 2025-12-18 04:14:20 +01:00
Update get_news() to work when no sources are provided.
Currently, `sources=[]` by default, which will become "" once the list is `joined` to form a csv string. The tiingo api appears to interpret the empty string as "don't match any sources" instead of "match all sources". This commit fixes the problem by setting `sources` to `None` if the list is empty. Adds unit test for empty new sources list. Updates HISTORY.rst with note about bug fix.
This commit is contained in:
committed by
DavidMinnen
parent
f6ef473b0d
commit
aed36edb65
@@ -183,6 +183,15 @@ class TestNews(TestCase):
|
||||
for article in articles:
|
||||
assert all(key in article for key in self.article_keys)
|
||||
|
||||
@vcr.use_cassette('tests/fixtures/news_empty_sources.yaml')
|
||||
def test_get_news_empty_sources(self):
|
||||
search_params = self.search_params.copy()
|
||||
search_params['sources'] = []
|
||||
articles = self._client.get_news(**search_params)
|
||||
assert len(articles) == self.num_articles
|
||||
for article in articles:
|
||||
assert all(key in article for key in self.article_keys)
|
||||
|
||||
@vcr.use_cassette('tests/fixtures/news_bulk.yaml')
|
||||
def test_get_news_bulk(self):
|
||||
"""Fails because this API key lacks institutional license"""
|
||||
|
||||
Reference in New Issue
Block a user