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_categorical_data(self, cat_data): assert as_json_table_type(cat_data) == "any"
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_date_data(self, date_data): assert as_json_table_type(date_data) == "datetime"
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_ext_integer_dtype(self): assert as_json_table_type(Int64Dtype()) == "integer"
def test_as_json_table_type_categorical_dtypes(self): assert as_json_table_type(pd.Categorical(["a"]).dtype) == "any" assert as_json_table_type(CategoricalDtype()) == "any"
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_ext_string_array_dtype(self, string_data): assert as_json_table_type(string_data.dtype) == "any"
def test_as_json_table_type_ext_string_dtype(self): assert as_json_table_type(StringDtype()) == "any"
def test_as_json_table_type_ext_decimal_dtype(self): assert as_json_table_type(DecimalDtype()) == "any"
def test_as_json_table_type_ext_decimal_array_dtype(self, decimal_data): assert as_json_table_type(decimal_data.dtype) == "any"
def test_as_json_table_type_ext_date_dtype(self): assert as_json_table_type(DateDtype()) == "any"
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_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"]).dtype) == "any" assert as_json_table_type(CategoricalDtype()) == "any"
def test_as_json_table_type_float_dtypes(self, float_dtype): assert as_json_table_type(float_dtype) == "number"
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_date_dtypes(self, date_dtype): # TODO: datedate.date? datetime.time? assert as_json_table_type(date_dtype) == "datetime"
def test_as_json_table_type_float_data(self, float_type): float_data = [1.0, 2.0, 3.0] assert as_json_table_type(np.array(float_data, dtype=float_type)) == "number"
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_ext_integer_array_dtype(self, integer_data): assert as_json_table_type(integer_data.dtype) == "integer"