Repository navigation
Conversation
This branch has not been deployed
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.
New Pull Request
Have you:
Change Notes
Fixes #928. Base-unit names such as
100bpsand100Bpscurrently parse as zero because their range lower bound is also used as their unit factor. Use one bit and eight bits per byte as the minimum factors, including when converting intoBps.bytes_to_namealso compares a byte input against bit-based thresholds and multiplies base-unit output by eight. Compare using the converted bit value and divide by the correct unit factor:950.0now produces950.0Bps, and1000.0produces1.0KBps. Five existing formatter expectations are corrected to match the documented bytes/s contract; prefixed and invalid-input cases remain covered.Justification
This repairs direct conversions and network automation templates using the existing Jinja filters. Formatting then parsing 950 bytes/s currently returns zero; it now preserves 950.0.
Validation: the final bandwidth tests fail on unchanged develop (32 failed, 96 passed) and pass with the fix (128 passed), including a real Jinja filter round trip. Full suites pass on CPython 3.10.22 and 3.14.10 (879 passed each), and 3.13.18 (877 passed, two skipped); all three pass 117 doctests. On Python 3.13, full Ruff formatting/lint, mypy, Pylint, yamllint, strict documentation build, Poetry check and Towncrier check pass. Poetry and docs tools emit existing deprecation notices. Tests run locally on Linux; no live network device testing was performed.