(self, query: str)
| 424 | self._row: tuple[int, str] | None = None |
| 425 | |
| 426 | def execute(self, query: str) -> None: |
| 427 | self.executed.append(query) |
| 428 | if "information_schema.columns" in query: |
| 429 | self._rows = [("orders(id int)",), ("users(name text)",)] |
| 430 | return |
| 431 | if query == "SHOW TABLES": |
| 432 | self._rows = [("orders",), ("broken",), ("empty",)] |
| 433 | return |
| 434 | if "`orders`" in query: |
| 435 | self.description = [("id", None), ("name", None)] |
| 436 | self._row = (1, "alice") |
| 437 | return |
| 438 | if "`broken`" in query: |
| 439 | raise RuntimeError("bad table") |
| 440 | if "`empty`" in query: |
| 441 | self.description = [("id", None)] |
| 442 | self._row = None |
| 443 | return |
| 444 | raise AssertionError(f"unexpected query: {query}") |
| 445 | |
| 446 | def fetchall(self) -> list[tuple[str]]: |
| 447 | return self._rows |
no outgoing calls
no test coverage detected