Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

1.2 KB
Raw Blame
/* Copyright 2026 Marimo. All rights reserved. */
import { describe, expect, test } from "vitest";
import { Tracebacks } from "@/__mocks__/tracebacks";
import { extractAllTracebackInfo } from "../traceback";

describe("traceback", () => {
  test("extracts cell-link", () => {
    const errors = extractAllTracebackInfo(Tracebacks.raw);
    expect(
      errors[0].kind === "file" &&
        errors[0].filePath.endsWith("marimo/_runtime/executor.py"),
    ).toBe(true);
    expect(errors.slice(1)).toMatchInlineSnapshot(`
      [
        {
          "cellId": "Hbol",
          "kind": "cell",
          "lineNumber": 4,
        },
        {
          "cellId": "Hbol",
          "kind": "cell",
          "lineNumber": 2,
        },
      ]
    `);
  });

  test("extracts cell-link from assertion", () => {
    const info = extractAllTracebackInfo(Tracebacks.assertion);
    expect(
      info[0].kind === "file" &&
        info[0].filePath.endsWith("marimo/_runtime/executor.py"),
    ).toBe(true);
    expect(info.slice(1)).toMatchInlineSnapshot(`
      [
        {
          "cellId": "Hbol",
          "kind": "cell",
          "lineNumber": 1,
        },
      ]
    `);
  });
});