def test_case_sensitive(self): class MYFUNC(GenericFunction): type = DateTime assert isinstance(func.MYFUNC().type, DateTime) assert isinstance(func.MyFunc().type, DateTime) assert isinstance(func.mYfUnC().type, DateTime) assert isinstance(func.myfunc().type, DateTime)
def test_case_sensitive(self): reg = functions._registry["_default"] cs_reg = functions._case_sensitive_registry["_default"] class MYFUNC(GenericFunction): type = DateTime assert isinstance(func.MYFUNC().type, DateTime) assert isinstance(func.MyFunc().type, DateTime) assert isinstance(func.mYfUnC().type, DateTime) assert isinstance(func.myfunc().type, DateTime) in_("myfunc", reg) not_in_("MYFUNC", reg) not_in_("MyFunc", reg) in_("myfunc", cs_reg) eq_(set(cs_reg["myfunc"].keys()), set(["MYFUNC"])) with testing.expect_deprecated( "GenericFunction 'MyFunc' is already registered with" " different letter case, so the previously registered function " "'MYFUNC' is switched into case-sensitive mode. " "GenericFunction objects will be fully case-insensitive in a " "future release.", regex=False, ): class MyFunc(GenericFunction): type = Integer assert isinstance(func.MYFUNC().type, DateTime) assert isinstance(func.MyFunc().type, Integer) with pytest.raises(AssertionError): assert isinstance(func.mYfUnC().type, Integer) with pytest.raises(AssertionError): assert isinstance(func.myfunc().type, Integer) eq_(reg["myfunc"], functions._CASE_SENSITIVE) not_in_("MYFUNC", reg) not_in_("MyFunc", reg) in_("myfunc", cs_reg) eq_(set(cs_reg["myfunc"].keys()), set(["MYFUNC", "MyFunc"]))