def test_function(self): fm = Function(keyspace=self.name, name=self.name, argument_types=(u'int', u'int'), argument_names=(u'x', u'y'), return_type=u'int', language=u'language', body=self.name, called_on_null_input=False, deterministic=True, monotonic=False, monotonic_on=(u'x',)) fm.export_as_string()
def test_as_cql_query_removes_frozen(self): func = Function("ks1", "myfunction", ["frozen<tuple<int, text>>"], ["a"], "int", "java", "return 0;", True) expected_result = ( "CREATE FUNCTION ks1.myfunction(a tuple<int, text>) " "CALLED ON NULL INPUT " "RETURNS int " "LANGUAGE java " "AS $$return 0;$$") self.assertEqual(expected_result, func.as_cql_query(formatted=False))
def test_function(self): fm = Function(self.name, self.name, (u'int', u'int'), (u'x', u'y'), u'int', u'language', self.name, False) fm.export_as_string()
def _function_with_kwargs(self, **kwargs): return Function(**dict(self.base_vars, **kwargs))