Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix print #7

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion tests/test_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

import jax.numpy as jnp
import numpy as np
from jax import jit, vmap
from jax import enable_custom_prng, jit, vmap
from jax.random import KeyArray, PRNGKey
from pytest import CaptureFixture
from rich.console import Console

Expand Down Expand Up @@ -139,6 +140,24 @@ def f(x: RealArray) -> RealArray:
""")


def test_tapped_key(capsys: CaptureFixture[str],
console: Console) -> None:
with enable_custom_prng():
key = PRNGKey(123)
@jit
def f(x: KeyArray) -> KeyArray:
return tapped_print_generic(x)

f(key)
captured = capsys.readouterr()
verify(captured.out,
"""
x=NumPy Array (3, 5) float64 batched over axes of size (4, 6)
├── mean=1.0
└── deviation=0.0
""")


def test_dict(capsys: CaptureFixture[str],
console: Console) -> None:
print_generic({'cat': 5,
Expand Down