Repository navigation
Fix str() spacing for units with R >= 4.7 - #450
Merged
Merged
Conversation
R-devel's str() no longer prepends a space to an object's output; callers now add it after "<name>:" instead. str.units() printed " Units: [m/s]" and relied on str() of the bare values for the separating space, so it printed "[m/s]num" there. Take the leading space from str() of the bare values, so the output follows whichever convention the running R uses, at top level and when nested in lists and data frames. Replace the snapshot, which encoded one convention, with a comparison against str() of the bare values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #450 +/- ##
==========================================
+ Coverage 92.93% 92.95% +0.02%
==========================================
Files 21 21
Lines 1203 1207 +4
==========================================
+ Hits 1118 1122 +4
Misses 85 85 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the
str workstest failure on R-devel (ubuntu-latest devel):Cause
R-devel changed the spacing of
str()output (NEWS: "str()'s output puts a space after"<some>:"… consistently now … by no longer prepending spaces, such that e.g.str(pi)'s output no longer starts with a space").str.units()printed" Units: [m/s]"and relied onstr()of the bare values to supply the separating space.Fix
str.units()takes the leading space fromstr()of the bare values (viacapture.output()), so it follows whichever convention the running R uses, rather than hard-coding the R version where it changed:Units: [m/s] num [1:3] 1 0.5 0.333Units: [m/s] num [1:3] 1 0.5 0.333$ x: Units: [m/s] num ...$ x: Units: [m/s] num ...The snapshot encoded one convention, so it is replaced by a test comparing
str()of a units vector, and of a data frame holding one, againststr()of the bare values. Unlike the snapshot, it also runs on CRAN.Testing
rocker/r-devel): full suite passes (718 tests, 0 failures; skips are optional packages not installed there).🤖 Generated with Claude Code