def test_clean_condition_timestamp_wrong_value(self): context = self._render_context( input_table=arrow_table( {"A": pa.array([datetime.now()], pa.timestamp("ns"))} ) ) with self.assertRaises(PromptingError) as cm: clean_value( ParamDType.Condition(), { "operation": "timestamp_is_greater_than", "column": "A", "value": "Yesterday", "isCaseSensitive": False, "isRegex": False, }, context, ) self.assertEqual( cm.exception.errors, [ PromptingError.CannotCoerceValueToTimestamp("Yesterday"), ], )
def test_clean_condition_timestamp_wrong_column_type_and_wrong_value(self): context = self._render_context(input_table=arrow_table({"A": [1]})) with self.assertRaises(PromptingError) as cm: clean_value( ParamDType.Condition(), { "operation": "timestamp_is_greater_than", "column": "A", "value": "Yesterday", "isCaseSensitive": False, "isRegex": False, }, context, ) self.assertEqual( cm.exception.errors, [ PromptingError.WrongColumnType( ["A"], "number", frozenset({"timestamp"}) ), PromptingError.CannotCoerceValueToTimestamp("Yesterday"), ], )