def test_as_json_table_type_categorical_data(self):
     self.assertEqual(as_json_table_type(pd.Categorical(['a'])), 'any')
     self.assertEqual(as_json_table_type(pd.Categorical([1])), 'any')
     self.assertEqual(as_json_table_type(
         pd.Series(pd.Categorical([1]))), 'any')
     self.assertEqual(as_json_table_type(pd.CategoricalIndex([1])), 'any')
     self.assertEqual(as_json_table_type(pd.Categorical([1])), 'any')
示例#2
0
 def test_as_json_table_type_categorical_data(self):
     self.assertEqual(as_json_table_type(pd.Categorical(['a'])), 'any')
     self.assertEqual(as_json_table_type(pd.Categorical([1])), 'any')
     self.assertEqual(as_json_table_type(
         pd.Series(pd.Categorical([1]))), 'any')
     self.assertEqual(as_json_table_type(pd.CategoricalIndex([1])), 'any')
     self.assertEqual(as_json_table_type(pd.Categorical([1])), 'any')
示例#3
0
 def test_as_json_table_type_float_data(self):
     float_data = [1., 2., 3.]
     float_types = [np.float, np.float16, np.float32, np.float64]
     for t in float_types:
         self.assertEqual(as_json_table_type(np.array(float_data,
                                                      dtype=t)),
                          'number')
 def test_as_json_table_type_float_data(self):
     float_data = [1., 2., 3.]
     float_types = [np.float, np.float16, np.float32, np.float64]
     for t in float_types:
         self.assertEqual(as_json_table_type(np.array(float_data,
                                                      dtype=t)),
                          'number')
 def test_as_json_table_type_date_data(self):
     date_data = [pd.to_datetime(['2016']),
                  pd.to_datetime(['2016'], utc=True),
                  pd.Series(pd.to_datetime(['2016'])),
                  pd.Series(pd.to_datetime(['2016'], utc=True)),
                  pd.period_range('2016', freq='A', periods=3)]
     for arr in date_data:
         self.assertEqual(as_json_table_type(arr), 'datetime')
示例#6
0
 def test_as_json_table_type_date_data(self):
     date_data = [pd.to_datetime(['2016']),
                  pd.to_datetime(['2016'], utc=True),
                  pd.Series(pd.to_datetime(['2016'])),
                  pd.Series(pd.to_datetime(['2016'], utc=True)),
                  pd.period_range('2016', freq='A', periods=3)]
     for arr in date_data:
         self.assertEqual(as_json_table_type(arr), 'datetime')
示例#7
0
 def test_as_json_table_type_date_dtypes(self):
     # TODO: datedate.date? datetime.time?
     dates = [
         np.datetime64,
         np.dtype("<M8[ns]"),
         PeriodDtype(),
         DatetimeTZDtype('ns', 'US/Central')
     ]
     for t in dates:
         self.assertEqual(as_json_table_type(t), 'datetime')
示例#8
0
 def test_as_json_table_type_categorical_data(self, cat_data):
     assert as_json_table_type(cat_data) == 'any'
示例#9
0
 def test_as_json_table_type_date_data(self, date_data):
     assert as_json_table_type(date_data) == 'datetime'
示例#10
0
 def test_as_json_table_type_float_data(self, float_type):
     float_data = [1., 2., 3.]
     assert as_json_table_type(np.array(float_data,
                                        dtype=float_type)) == 'number'
示例#11
0
 def test_as_json_table_type_timedelta_dtypes(self):
     durations = [np.timedelta64, np.dtype("<m8[ns]")]
     for t in durations:
         assert as_json_table_type(t) == 'duration'
示例#12
0
 def test_as_json_table_type_string_dtypes(self):
     strings = [object]  # TODO
     for t in strings:
         self.assertEqual(as_json_table_type(t), 'string')
示例#13
0
 def test_as_json_table_type_string_data(self):
     strings = [pd.Series(['a', 'b']), pd.Index(['a', 'b'])]
     for t in strings:
         self.assertEqual(as_json_table_type(t), 'string')
示例#14
0
 def test_as_json_table_type_string_dtypes(self, str_dtype):
     assert as_json_table_type(str_dtype) == 'string'
 def test_as_json_table_type_categorical_dtypes(self):
     self.assertEqual(as_json_table_type(pd.Categorical), 'any')
     self.assertEqual(as_json_table_type(CategoricalDtype()), 'any')
 def test_as_json_table_type_string_dtypes(self):
     strings = [object]  # TODO
     for t in strings:
         self.assertEqual(as_json_table_type(t), 'string')
 def test_as_json_table_type_timedelta_dtypes(self):
     durations = [np.timedelta64, np.dtype("<m8[ns]")]
     for t in durations:
         self.assertEqual(as_json_table_type(t), 'duration')
 def test_as_json_table_type_date_dtypes(self):
     # TODO: datedate.date? datetime.time?
     dates = [np.datetime64, np.dtype("<M8[ns]"), PeriodDtype(),
              DatetimeTZDtype('ns', 'US/Central')]
     for t in dates:
         self.assertEqual(as_json_table_type(t), 'datetime')
 def test_as_json_table_type_bool_dtypes(self):
     bools = [bool, np.bool]
     for t in bools:
         self.assertEqual(as_json_table_type(t), 'boolean')
 def test_as_json_table_type_float_dtypes(self):
     floats = [np.float, np.float16, np.float32, np.float64]
     for t in floats:
         self.assertEqual(as_json_table_type(t), 'number')
 def test_as_json_table_type_int_dtypes(self):
     integers = [np.int, np.int16, np.int32, np.int64]
     for t in integers:
         self.assertEqual(as_json_table_type(t), 'integer')
示例#22
0
 def test_as_json_table_type_float_dtypes(self, float_dtype):
     assert as_json_table_type(float_dtype) == 'number'
示例#23
0
 def test_as_json_table_type_date_dtypes(self, date_dtype):
     # TODO: datedate.date? datetime.time?
     assert as_json_table_type(date_dtype) == 'datetime'
 def test_as_json_table_type_int_data(self):
     int_data = [1, 2, 3]
     int_types = [np.int, np.int16, np.int32, np.int64]
     for t in int_types:
         self.assertEqual(as_json_table_type(np.array(int_data, dtype=t)),
                          'integer')
示例#25
0
 def test_as_json_table_type_bool_data(self):
     bool_data = [True, False]
     bool_types = [bool, np.bool]
     for t in bool_types:
         self.assertEqual(as_json_table_type(np.array(bool_data, dtype=t)),
                          'boolean')
示例#26
0
 def test_as_json_table_type_bool_dtypes(self):
     bools = [bool, np.bool]
     for t in bools:
         assert as_json_table_type(t) == 'boolean'
 def test_as_json_table_type_bool_data(self):
     bool_data = [True, False]
     bool_types = [bool, np.bool]
     for t in bool_types:
         self.assertEqual(as_json_table_type(np.array(bool_data, dtype=t)),
                          'boolean')
示例#28
0
 def test_as_json_table_type_string_dtypes(self):
     strings = [object]  # TODO
     for t in strings:
         assert as_json_table_type(t) == 'string'
示例#29
0
 def test_as_json_table_type_int_data(self):
     int_data = [1, 2, 3]
     int_types = [np.int, np.int16, np.int32, np.int64]
     for t in int_types:
         self.assertEqual(as_json_table_type(np.array(int_data, dtype=t)),
                          'integer')
 def test_as_json_table_type_string_data(self):
     strings = [pd.Series(['a', 'b']), pd.Index(['a', 'b'])]
     for t in strings:
         self.assertEqual(as_json_table_type(t), 'string')
示例#31
0
 def test_as_json_table_type_timedelta_dtypes(self):
     durations = [np.timedelta64, np.dtype("<m8[ns]")]
     for t in durations:
         assert as_json_table_type(t) == 'duration'
 def test_as_json_table_type_bool_data(self, bool_type):
     bool_data = [True, False]
     assert as_json_table_type(np.array(
         bool_data, dtype=bool_type)) == 'boolean'
示例#33
0
 def test_as_json_table_type_categorical_dtypes(self):
     assert as_json_table_type(pd.Categorical) == 'any'
     assert as_json_table_type(CategoricalDtype()) == 'any'
 def test_as_json_table_type_date_data(self, date_data):
     assert as_json_table_type(date_data) == 'datetime'
示例#35
0
 def test_as_json_table_type_int_data(self, int_type):
     int_data = [1, 2, 3]
     assert as_json_table_type(np.array(int_data,
                                        dtype=int_type)) == 'integer'
 def test_as_json_table_type_string_data(self, str_data):
     assert as_json_table_type(str_data) == 'string'
示例#37
0
 def test_as_json_table_type_bool_data(self, bool_type):
     bool_data = [True, False]
     assert as_json_table_type(np.array(bool_data,
                                        dtype=bool_type)) == 'boolean'
 def test_as_json_table_type_categorical_data(self, cat_data):
     assert as_json_table_type(cat_data) == 'any'
示例#39
0
 def test_as_json_table_type_string_data(self, str_data):
     assert as_json_table_type(str_data) == 'string'
 def test_as_json_table_type_int_dtypes(self, int_dtype):
     assert as_json_table_type(int_dtype) == 'integer'
示例#41
0
 def test_as_json_table_type_int_dtypes(self, int_dtype):
     assert as_json_table_type(int_dtype) == 'integer'
 def test_as_json_table_type_float_dtypes(self, float_dtype):
     assert as_json_table_type(float_dtype) == 'number'
示例#43
0
 def test_as_json_table_type_bool_dtypes(self, bool_dtype):
     assert as_json_table_type(bool_dtype) == 'boolean'
 def test_as_json_table_type_bool_dtypes(self, bool_dtype):
     assert as_json_table_type(bool_dtype) == 'boolean'
示例#45
0
 def test_as_json_table_type_timedelta_dtypes(self, td_dtype):
     assert as_json_table_type(td_dtype) == 'duration'
 def test_as_json_table_type_date_dtypes(self, date_dtype):
     # TODO: datedate.date? datetime.time?
     assert as_json_table_type(date_dtype) == 'datetime'
示例#47
0
 def test_as_json_table_type_categorical_dtypes(self):
     # TODO: I think before is_categorical_dtype(Categorical)
     # returned True, but now it's False. Figure out why or
     # if it matters
     assert as_json_table_type(pd.Categorical(['a'])) == 'any'
     assert as_json_table_type(CategoricalDtype()) == 'any'
 def test_as_json_table_type_timedelta_dtypes(self, td_dtype):
     assert as_json_table_type(td_dtype) == 'duration'
示例#49
0
 def test_as_json_table_type_int_dtypes(self):
     integers = [np.int, np.int16, np.int32, np.int64]
     for t in integers:
         self.assertEqual(as_json_table_type(t), 'integer')
示例#50
0
 def test_as_json_table_type_bool_dtypes(self):
     bools = [bool, np.bool]
     for t in bools:
         self.assertEqual(as_json_table_type(t), 'boolean')
 def test_as_json_table_type_string_dtypes(self, str_dtype):
     assert as_json_table_type(str_dtype) == 'string'
示例#52
0
 def test_as_json_table_type_string_dtypes(self):
     strings = [object]  # TODO
     for t in strings:
         assert as_json_table_type(t) == 'string'
示例#53
0
 def test_as_json_table_type_float_dtypes(self):
     floats = [np.float, np.float16, np.float32, np.float64]
     for t in floats:
         self.assertEqual(as_json_table_type(t), 'number')
 def test_as_json_table_type_categorical_dtypes(self):
     # TODO: I think before is_categorical_dtype(Categorical)
     # returned True, but now it's False. Figure out why or
     # if it matters
     assert as_json_table_type(pd.Categorical(['a'])) == 'any'
     assert as_json_table_type(CategoricalDtype()) == 'any'
示例#55
0
 def test_as_json_table_type_timedelta_dtypes(self):
     durations = [np.timedelta64, np.dtype("<m8[ns]")]
     for t in durations:
         self.assertEqual(as_json_table_type(t), 'duration')
 def test_as_json_table_type_int_data(self, int_type):
     int_data = [1, 2, 3]
     assert as_json_table_type(np.array(
         int_data, dtype=int_type)) == 'integer'
示例#57
0
 def test_as_json_table_type_categorical_dtypes(self):
     self.assertEqual(as_json_table_type(pd.Categorical), 'any')
     self.assertEqual(as_json_table_type(CategoricalDtype()), 'any')
 def test_as_json_table_type_float_data(self, float_type):
     float_data = [1., 2., 3.]
     assert as_json_table_type(np.array(
         float_data, dtype=float_type)) == 'number'
示例#59
0
 def test_as_json_table_type_bool_dtypes(self):
     bools = [bool, np.bool]
     for t in bools:
         assert as_json_table_type(t) == 'boolean'
示例#60
0
 def test_as_json_table_type_float_dtypes(self):
     floats = [np.float, np.float16, np.float32, np.float64]
     for t in floats:
         assert as_json_table_type(t) == 'number'