Skip to content

refactor(graph-print): improve format_param output and add tests#281

Open
sebffischer wants to merge 1 commit into
mainfrom
graph-print-format-params
Open

refactor(graph-print): improve format_param output and add tests#281
sebffischer wants to merge 1 commit into
mainfrom
graph-print-format-params

Conversation

@sebffischer
Copy link
Copy Markdown
Contributor

Summary

  • format_param() now handles a few more cases more usefully: top-level NULL and list() still print as empty, but a NULL inside a list renders as NULL instead of silently vanishing. Empty atomic vectors render as integer(0) / character(0) / logical(0) rather than "". Character values are quoted (\"abc\", c(\"a\", \"b\")). Unknown objects fall back to deparse(x, nlines = 1) or <class> instead of <any>.
  • Split the generic formatting path into a separate format_param_value() helper so the top-level empty-case check stays in format_param().
  • Added snapshot-based unit tests for format_param in tests/testthat/test-graph-print.R covering empty cases, atomic scalars/vectors, empty atomic vectors, named/unnamed lists, nested NULL, nested lists, dtype repr, and the graph [n -> m] summary.

Test plan

  • devtools::test(filter = \"graph-print\") — 16 tests pass.
  • Review the recorded snapshots in tests/testthat/_snaps/graph-print.md.

🤖 Generated with Claude Code

Distinguish top-level NULL/empty from nested NULL, show empty atomic
vectors as typeof(0), quote character values, and fall back to
deparse()/<class> for generic objects. Add unit snapshots covering
each branch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sebffischer
Copy link
Copy Markdown
Contributor Author

@dfalbel can you please check the CUDA runner? It keeps failing for some reason for some time

@dfalbel
Copy link
Copy Markdown
Contributor

dfalbel commented Apr 24, 2026

I have restarted the machine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants