@property
    @contextmanager
    def transact(self):
        assert self._query("BEGIN") == "BEGIN"
        self.wait_for_state()
        assert self.state == "T"

        try:
            yield self
        except Rollback:
            assert self.state == "T"
            assert self._query("ROLLBACK") == "ROLLBACK"
            self.wait_for_state()
            assert self.state == "I"
        else:
            assert not self.in_query, "Cannot commit with unconsumed query data"
            assert self.state != "T"
            assert self._query("COMMIT") == "COMMIT"
            self.wait_for_state()
            assert self.state == "I"
dataset/ETHPy150Open dieseldev/diesel/diesel/protocols/pg.py/PostgreSQLClient.transact/operator `==` -> `!=`