Skip to main content

serp-test

Serpentine's test library ([P] pure Serpentine, docs/libraries.md Wave 1).

unittest-style TestCase (0.2.0)

from __future__ import annotations
from serp_test import TestCase
from serpentine import Ref, dataclass


@dataclass
class MathTest(TestCase):
    def test_add(self: Ref[MathTest]) -> None:
        self.assertEqual(2 + 2, 4)

Run with serp test: it discovers test_*.py files, finds TestCase subclasses at build time (no runtime reflection), generates a native runner per file, and reports FAIL: test_x (Class) - message lines plus a Ran N test(s) / OK / FAILED (failures=K) summary. A file passes when its runner exits 0. Files without TestCase subclasses run as plain programs (exit-0 contract), so the legacy function style keeps working.

Assert methods (CPython-style messages, raising AssertionError): assertTrue/assertFalse, assertEqual/assertNotEqual (PyVal — any values), assertIn/assertNotIn, assertIsNone/assertIsNotNone, assertAlmostEqual(first, second, places=7), assertRaises(fn) (zero-arg function reference; any exception counts), fail(msg), plus setUp/tearDown hooks (fresh instance per test method).

Divergences from unittest: subclasses carry @dataclass and must default every field (zero-arg construction); assertRaises takes a function reference instead of an exception class + callable; no unittest.main() (discovery lives in serp test); no msg= parameter on asserts.

Legacy helpers

  • from serp_test import assert_true, assert_false, assert_eq_int, assert_eq_str, assert_eq_float, assert_close, fail
  • Failed assertions raise ValueError with an assertion failed: prefix.

Install into a Serpentine project with serp add serp-test.

Metadata

Release files for serp-test 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for serp-test 0.2.0
File Size Uploaded
serp_test-0.2.0.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for serp-test 0.2.0
File Interpreter ABI Platform
serp_test-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.4 kB

Release files / serp_test-0.2.0.tar.gz

Download URL serp_test-0.2.0.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
47c274bd506395957fb5029e62f3411bccd3c942aa1e6e5fdd74ecef24d7b6e9
BLAKE2b-256 checksum
How to use checksums
d5570e3f6a376baa8a85661b708e2ef5a5bd4c64ec1f4f79432ec4fa4fa19a73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release files / serp_test-0.2.0-py3-none-any.whl

Download URL serp_test-0.2.0-py3-none-any.whl
Size 3.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f04321f65d5b7c45816126988f078ec605f83367d6c0870972f17f726cbdf1c
BLAKE2b-256 checksum
How to use checksums
f21b6fac209aa2a449b2c6b6271f1c9e7e94745d46f7c1dda245944d6b2c7408
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page