def test_data_calls_connection_get(self, mock):
     datatable = Datatable('ZACKS/FC')
     Data.page(datatable, params={'ticker': ['AAPL', 'MSFT'],
                                  'per_end_date': {'gte': '2015-01-01'},
                                  'qopts': {'columns': ['ticker', 'per_end_date']}})
     expected = call('get', 'datatables/ZACKS/FC',
                     params={'ticker[]': ['AAPL', 'MSFT'],
                             'per_end_date.gte': '2015-01-01',
                             'qopts.columns[]': ['ticker', 'per_end_date']})
     self.assertEqual(mock.call_args, expected)
 def test_data_calls_connection_post(self, mock):
     RequestType.USE_GET_REQUEST = False
     datatable = Datatable('ZACKS/FC')
     Data.page(datatable, params={'ticker': ['AAPL', 'MSFT'],
                                  'per_end_date': {'gte': '2015-01-01'},
                                  'qopts': {'columns': ['ticker', 'per_end_date']}})
     expected = call('post', 'datatables/ZACKS/FC',
                     json={'ticker': ['AAPL', 'MSFT'],
                             'per_end_date.gte': '2015-01-01',
                             'qopts.columns': ['ticker', 'per_end_date']})
     self.assertEqual(mock.call_args, expected)
 def test_to_numpy_returns_numpy_object(self, request_method):
     if request_method == 'POST':
         RequestType.USE_GET_REQUEST = False
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     data = results.to_numpy()
     self.assertIsInstance(data, numpy.core.records.recarray)
 def test_pandas_dataframe_index_is_none(self, request_method):
     if request_method == 'POST':
         RequestType.USE_GET_REQUEST = False
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     df = results.to_pandas()
     self.assertEqual(df.index.name, 'None')
 def test_values_and_meta_exist(self, request_method):
     if request_method == 'POST':
         RequestType.USE_GET_REQUEST = False
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     self.assertIsNotNone(results.values)
     self.assertIsNotNone(results.meta)
 def test_values_and_meta_exist(self, request_method):
     if request_method == 'POST':
         RequestType.USE_GET_REQUEST = False
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     self.assertIsNotNone(results.values)
     self.assertIsNotNone(results.meta)
 def test_to_numpy_returns_numpy_object(self, request_method):
     if request_method == 'POST':
         RequestType.USE_GET_REQUEST = False
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     data = results.to_numpy()
     self.assertIsInstance(data, numpy.core.records.recarray)
 def test_to_pandas_returns_pandas_dataframe_object(self, request_method):
     if request_method == 'POST':
         RequestType.USE_GET_REQUEST = False
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     df = results.to_pandas()
     self.assertIsInstance(df, pandas.core.frame.DataFrame)
 def test_pandas_dataframe_index_is_none(self, request_method):
     if request_method == 'POST':
         RequestType.USE_GET_REQUEST = False
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     df = results.to_pandas()
     self.assertEqual(df.index.name, 'None')
 def test_to_pandas_returns_pandas_dataframe_object(self, request_method):
     if request_method == 'POST':
         RequestType.USE_GET_REQUEST = False
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     df = results.to_pandas()
     self.assertIsInstance(df, pandas.core.frame.DataFrame)
 def test_pandas_dataframe_date_field_is_datetime(self):
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     df = results.to_pandas()
     self.assertIsInstance(df['per_end_date'][0], pandas.datetime)
     self.assertIsInstance(df['per_end_date'][1], pandas.datetime)
     self.assertIsInstance(df['per_end_date'][2], pandas.datetime)
     self.assertIsInstance(df['per_end_date'][3], pandas.datetime)
 def test_pandas_dataframe_date_field_is_datetime(self):
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     df = results.to_pandas()
     self.assertIsInstance(df['per_end_date'][0], pandas.datetime)
     self.assertIsInstance(df['per_end_date'][1], pandas.datetime)
     self.assertIsInstance(df['per_end_date'][2], pandas.datetime)
     self.assertIsInstance(df['per_end_date'][3], pandas.datetime)
 def test_to_csv_returns_expected_csv(self):
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     data = results.to_csv()
     expected = "None,per_end_date,ticker,tot_oper_exp\n" + \
                "0,2015-07-11,AAPL,456.9\n" + \
                "1,2015-07-13,433.3,\n" + \
                "2,2015-07-14,AAPL,419.1\n" + \
                "3,2015-07-15,476.5,\n"
     self.assertEqual(data, expected)
 def test_to_csv_returns_expected_csv(self):
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     data = results.to_csv()
     expected = "None,per_end_date,ticker,tot_oper_exp\n" + \
                "0,2015-07-11,AAPL,456.9\n" + \
                "1,2015-07-13,433.3,\n" + \
                "2,2015-07-14,AAPL,419.1\n" + \
                "3,2015-07-15,476.5,\n"
     self.assertEqual(data, expected)
 def test_pandas_dataframe_date_field_is_datetime(self, request_method):
     if request_method == 'POST':
         RequestType.USE_GET_REQUEST = False
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     df = results.to_pandas()
     self.assertIsInstance(df['per_end_date'][0], pandas.datetime)
     self.assertIsInstance(df['per_end_date'][1], pandas.datetime)
     self.assertIsInstance(df['per_end_date'][2], pandas.datetime)
     self.assertIsInstance(df['per_end_date'][3], pandas.datetime)
Esempio n. 16
0
 def test_pandas_dataframe_date_field_is_datetime(self, request_method):
     if request_method == 'POST':
         RequestType.USE_GET_REQUEST = False
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     df = results.to_pandas()
     self.assertIsInstance(df['per_end_date'][0], pandas.datetime)
     self.assertIsInstance(df['per_end_date'][1], pandas.datetime)
     self.assertIsInstance(df['per_end_date'][2], pandas.datetime)
     self.assertIsInstance(df['per_end_date'][3], pandas.datetime)
 def test_data_calls_connection_get(self, mock):
     datatable = Datatable('ZACKS/FC')
     Data.page(datatable,
               params={
                   'ticker': ['AAPL', 'MSFT'],
                   'per_end_date': {
                       'gte': '2015-01-01'
                   },
                   'qopts': {
                       'columns': ['ticker', 'per_end_date']
                   }
               })
     expected = call('get',
                     'datatables/ZACKS/FC',
                     params={
                         'ticker[]': ['AAPL', 'MSFT'],
                         'per_end_date.gte': '2015-01-01',
                         'qopts.columns[]': ['ticker', 'per_end_date']
                     })
     self.assertEqual(mock.call_args, expected)
 def test_data_calls_connection_post(self, mock):
     RequestType.USE_GET_REQUEST = False
     datatable = Datatable('ZACKS/FC')
     Data.page(datatable,
               params={
                   'ticker': ['AAPL', 'MSFT'],
                   'per_end_date': {
                       'gte': '2015-01-01'
                   },
                   'qopts': {
                       'columns': ['ticker', 'per_end_date']
                   }
               })
     expected = call('post',
                     'datatables/ZACKS/FC',
                     json={
                         'ticker': ['AAPL', 'MSFT'],
                         'per_end_date.gte': '2015-01-01',
                         'qopts.columns': ['ticker', 'per_end_date']
                     })
     self.assertEqual(mock.call_args, expected)
Esempio n. 19
0
 def test_to_csv_returns_expected_csv(self, request_method):
     if request_method == 'POST':
         RequestType.USE_GET_REQUEST = False
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     data = results.to_csv()
     expected = "None,per_end_date,ticker,tot_oper_exp\n" + \
                "0,2015-07-11,AAPL,456.9\n" + \
                "1,2015-07-13,433.3,\n" + \
                "2,2015-07-14,AAPL,419.1\n" + \
                "3,2015-07-15,476.5,\n"
     self.assertEqual(data, expected)
 def test_to_csv_returns_expected_csv(self, request_method):
     if request_method == 'POST':
         RequestType.USE_GET_REQUEST = False
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     data = results.to_csv()
     expected = "None,per_end_date,ticker,tot_oper_exp\n" + \
                "0,2015-07-11,AAPL,456.9\n" + \
                "1,2015-07-13,433.3,\n" + \
                "2,2015-07-14,AAPL,419.1\n" + \
                "3,2015-07-15,476.5,\n"
     self.assertEqual(data, expected)
 def test_to_pandas_returns_pandas_dataframe_object(self):
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     df = results.to_pandas()
     self.assertIsInstance(df, pandas.core.frame.DataFrame)
 def test_values_and_meta_exist(self):
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     self.assertIsNotNone(results.values)
     self.assertIsNotNone(results.meta)
 def test_values_and_meta_exist(self):
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     self.assertIsNotNone(results.values)
     self.assertIsNotNone(results.meta)
 def test_to_numpy_returns_numpy_object(self):
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     data = results.to_numpy()
     self.assertIsInstance(data, numpy.core.records.recarray)
 def test_to_pandas_returns_pandas_dataframe_object(self):
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     df = results.to_pandas()
     self.assertIsInstance(df, pandas.core.frame.DataFrame)
 def test_pandas_dataframe_index_is_none(self):
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     df = results.to_pandas()
     self.assertEqual(df.index.name, 'None')
 def test_pandas_dataframe_index_is_none(self):
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     df = results.to_pandas()
     self.assertEqual(df.index.name, 'None')
 def test_to_numpy_returns_numpy_object(self):
     datatable = Datatable('ZACKS/FC')
     results = Data.page(datatable, params={})
     data = results.to_numpy()
     self.assertIsInstance(data, numpy.core.records.recarray)