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.

809 B
Raw Blame
/* Copyright 2026 Marimo. All rights reserved. */

import { describe, expect, it } from "vitest";
import { hasFunctionProperty, isRecord } from "../records";

describe("isRecord", () => {
  it("should accept plain objects", () => {
    expect(isRecord({})).toBe(true);
    expect(isRecord({ a: 1 })).toBe(true);
  });

  it("should reject null, arrays, and primitives", () => {
    expect(isRecord(null)).toBe(false);
    expect(isRecord([])).toBe(false);
    expect(isRecord("x")).toBe(false);
    expect(isRecord(1)).toBe(false);
  });
});

describe("hasFunctionProperty", () => {
  it("should detect function properties", () => {
    expect(hasFunctionProperty({ render: () => undefined }, "render")).toBe(
      true,
    );
    expect(hasFunctionProperty({ render: 1 }, "render")).toBe(false);
  });
});