18 lines
696 B
TypeScript
18 lines
696 B
TypeScript
import type { PythonKernelExecutor } from "@oh-my-pi/pi-coding-agent/eval/py/executor";
|
|
import type { KernelExecuteOptions, KernelExecuteResult } from "@oh-my-pi/pi-coding-agent/eval/py/kernel";
|
|
|
|
export class FakeKernel implements PythonKernelExecutor {
|
|
private result: KernelExecuteResult;
|
|
private onExecute: (options?: KernelExecuteOptions) => Promise<void> | void;
|
|
|
|
constructor(result: KernelExecuteResult, onExecute: (options?: KernelExecuteOptions) => Promise<void> | void) {
|
|
this.result = result;
|
|
this.onExecute = onExecute;
|
|
}
|
|
|
|
async execute(_code: string, options?: KernelExecuteOptions): Promise<KernelExecuteResult> {
|
|
await this.onExecute(options);
|
|
return this.result;
|
|
}
|
|
}
|