mirror of
https://github.com/hydrosquall/tiingo-python.git
synced 2025-12-19 20:54:18 +01:00
Update test descriptions and simplify some assertions
This commit is contained in:
@@ -100,7 +100,7 @@ class TestTickerPrices(TestCase):
|
|||||||
|
|
||||||
@vcr.use_cassette('tests/fixtures/ticker_price_with_volume_column.yaml')
|
@vcr.use_cassette('tests/fixtures/ticker_price_with_volume_column.yaml')
|
||||||
def test_ticker_price_with_volume_column(self):
|
def test_ticker_price_with_volume_column(self):
|
||||||
"""Confirm that CSV endpoint works"""
|
"""Confirm that requesting a single column works"""
|
||||||
prices = self._client.get_ticker_price("GOOGL",
|
prices = self._client.get_ticker_price("GOOGL",
|
||||||
columns="volume",
|
columns="volume",
|
||||||
fmt='json')
|
fmt='json')
|
||||||
@@ -114,7 +114,7 @@ class TestTickerPrices(TestCase):
|
|||||||
|
|
||||||
@vcr.use_cassette('tests/fixtures/ticker_price_with_multiple_columns.yaml')
|
@vcr.use_cassette('tests/fixtures/ticker_price_with_multiple_columns.yaml')
|
||||||
def test_ticker_price_with_multiple_columns(self):
|
def test_ticker_price_with_multiple_columns(self):
|
||||||
"""Confirm that CSV endpoint works"""
|
"""Confirm that requesting specific columns works"""
|
||||||
prices = self._client.get_ticker_price("GOOGL",
|
prices = self._client.get_ticker_price("GOOGL",
|
||||||
columns="open,high,low,close,volume",
|
columns="open,high,low,close,volume",
|
||||||
fmt='json')
|
fmt='json')
|
||||||
|
|||||||
@@ -116,21 +116,23 @@ class TestTiingoWithPython(TestCase):
|
|||||||
|
|
||||||
@vcr.use_cassette('tests/fixtures/ticker_price_with_volume_column.yaml')
|
@vcr.use_cassette('tests/fixtures/ticker_price_with_volume_column.yaml')
|
||||||
def test_get_dataframe_with_volume_column(self):
|
def test_get_dataframe_with_volume_column(self):
|
||||||
"""Confirm that CSV endpoint works"""
|
"""Confirm that requesting a single column works"""
|
||||||
|
requested_column = "volume"
|
||||||
prices = self._client.get_dataframe("GOOGL",
|
prices = self._client.get_dataframe("GOOGL",
|
||||||
columns="volume",
|
columns=requested_column,
|
||||||
fmt='json')
|
fmt='json')
|
||||||
assert len(prices) == 1
|
assert len(prices) == 1
|
||||||
assert len(prices.columns) == 2
|
assert len(prices.columns) == len(requested_column) + 1
|
||||||
|
|
||||||
@vcr.use_cassette('tests/fixtures/ticker_price_with_multiple_columns.yaml')
|
@vcr.use_cassette('tests/fixtures/ticker_price_with_multiple_columns.yaml')
|
||||||
def test_get_dataframe_with_multiple_columns(self):
|
def test_get_dataframe_with_multiple_columns(self):
|
||||||
"""Confirm that CSV endpoint works"""
|
"""Confirm that requesting specific columns works"""
|
||||||
|
requested_columns = "open,high,low,close,volume"
|
||||||
prices = self._client.get_dataframe("GOOGL",
|
prices = self._client.get_dataframe("GOOGL",
|
||||||
columns="open,high,low,close,volume",
|
columns=requested_columns,
|
||||||
fmt='json')
|
fmt='json')
|
||||||
assert len(prices) == 1
|
assert len(prices) == 1
|
||||||
assert len(prices.columns) == 6
|
assert len(prices.columns) == len(requested_columns.split(",")) + 1
|
||||||
|
|
||||||
def test_metric_name_column_error(self):
|
def test_metric_name_column_error(self):
|
||||||
with self.assertRaises(APIColumnNameError):
|
with self.assertRaises(APIColumnNameError):
|
||||||
|
|||||||
Reference in New Issue
Block a user