{"id":16536415,"url":"https://github.com/tillahoffmann/testax","last_synced_at":"2025-07-25T12:37:53.752Z","repository":{"id":223793685,"uuid":"761516267","full_name":"tillahoffmann/testax","owner":"tillahoffmann","description":"Jit-able runtime assertions for JAX in NumPy style.","archived":false,"fork":false,"pushed_at":"2024-03-03T04:52:36.000Z","size":46,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-23T16:16:22.937Z","etag":null,"topics":["jax","numpy","testing"],"latest_commit_sha":null,"homepage":"https://testax.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tillahoffmann.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-22T01:12:24.000Z","updated_at":"2024-03-05T06:51:10.000Z","dependencies_parsed_at":"2024-10-11T18:31:17.377Z","dependency_job_id":null,"html_url":"https://github.com/tillahoffmann/testax","commit_stats":null,"previous_names":["tillahoffmann/testax"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tillahoffmann/testax","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tillahoffmann%2Ftestax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tillahoffmann%2Ftestax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tillahoffmann%2Ftestax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tillahoffmann%2Ftestax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tillahoffmann","download_url":"https://codeload.github.com/tillahoffmann/testax/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tillahoffmann%2Ftestax/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266769053,"owners_count":23981372,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jax","numpy","testing"],"created_at":"2024-10-11T18:31:11.262Z","updated_at":"2025-07-25T12:37:53.685Z","avatar_url":"https://github.com/tillahoffmann.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"🧪 testax\n=========\n\n.. image:: https://img.shields.io/pypi/v/testax\n    :target: https://pypi.org/project/testax\n.. image:: https://github.com/tillahoffmann/testax/actions/workflows/build.yml/badge.svg\n    :target: https://github.com/tillahoffmann/testax/actions/workflows/build.yml\n.. image:: https://readthedocs.org/projects/testax/badge/?version=latest\n    :target: https://testax.readthedocs.io/en/latest/?badge=latest\n\ntestax provides runtime assertions for JAX through the testing interface familiar to NumPy users.\n\n\u003e\u003e\u003e import jax\n\u003e\u003e\u003e from jax import numpy as jnp\n\u003e\u003e\u003e import testax\n\u003e\u003e\u003e\n\u003e\u003e\u003e def safe_log(x):\n...     testax.assert_array_less(0, x)\n...     return jnp.log(x)\n\u003e\u003e\u003e\n\u003e\u003e\u003e safe_log(jnp.arange(2))\nTraceback (most recent call last):\n    ...\njax._src.checkify.JaxRuntimeError:\nArrays are not less-ordered\n\u003cBLANKLINE\u003e\nMismatched elements: 1 / 2 (50%)\nMax absolute difference: 1\nMax relative difference: 1\n x: Array(0, dtype=int32, weak_type=True)\n y: Array([0, 1], dtype=int32)\n\ntestax assertions are :code:`jit`-able, although errors need to be functionalized to conform to JAX's requirement that functions are pure and do not have side effects (see the :code:`checkify` `guide \u003chttps://jax.readthedocs.io/en/latest/debugging/checkify_guide.html\u003e`__ for details). In short, a :code:`checkify`-d function returns a tuple :code:`(error, value)`. The first element is an error that *may* have occurred, and the second is the return value of the original function.\n\n\u003e\u003e\u003e jitted = jax.jit(safe_log)\n\u003e\u003e\u003e checkified = testax.checkify(jitted)\n\u003e\u003e\u003e error, y = checkified(jnp.arange(2))\n\u003e\u003e\u003e error.throw()\nTraceback (most recent call last):\n    ...\njax._src.checkify.JaxRuntimeError:\nArrays are not less-ordered\n\u003cBLANKLINE\u003e\nMismatched elements: 1 / 2 (50%)\nMax absolute difference: 1\nMax relative difference: 1\n x: Array(0, dtype=int32, weak_type=True)\n y: Array([0, 1], dtype=int32)\n\u003e\u003e\u003e y\nArray([-inf,   0.], dtype=float32)\n\nInstallation\n------------\n\ntestax is pip-installable and can be installed by running\n\n.. code-block:: bash\n\n    pip install testax\n\nInterface\n---------\n\ntestax mirrors the `testing \u003chttps://numpy.org/doc/stable/reference/routines.testing.html\u003e`__ interface familiar to NumPy users, such as :code:`assert_allclose`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftillahoffmann%2Ftestax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftillahoffmann%2Ftestax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftillahoffmann%2Ftestax/lists"}