def test_create_trigger_conditional(self):
        "Create a trigger with a WHEN qualification"
        if self.db.version < 90000:
            self.skipTest('Only available on PG 9.0')
        inmap = self.std_map()
        inmap['schema public'].update({'function f1()': {
            'language': 'plpgsql', 'returns': 'trigger', 'source': FUNC_SRC}})
        inmap['schema public'].update({'table t1': {
            'columns': [{'c1': {'type': 'integer'}}, {'c2': {'type': 'text'}},
                        {'c3': {'type': 'timestamp with time zone'}}],
            'triggers': {'tr1': {'timing': 'before', 'events': [
                'update'], 'level': 'row', 'procedure': 'f1()',
                'condition': '(old.c2 IS DISTINCT FROM new.c2)'}}}})
        sql = self.to_sql(inmap)
        assert fix_indent(sql[1]) == CREATE_FUNC_STMT
        assert fix_indent(sql[2]) == CREATE_TABLE_STMT
        assert fix_indent(sql[3]) == "CREATE TRIGGER tr1 BEFORE UPDATE " \
            "ON t1 FOR EACH ROW WHEN ((old.c2 IS DISTINCT FROM new.c2)) " \
            "EXECUTE PROCEDURE f1()"
dataset/ETHPy150Open perseas/Pyrseas/tests/dbobject/test_trigger.py/TriggerToSqlTestCase.test_create_trigger_conditional/original