GeezerVison is showing github.com — Test the fmm engine guards and config key completions; combine repeated indices in csr, csc and GCXS imports by eriknw · Pull Request #609 · python-graphblas/python-graphblas
Conversation
eriknw
commented
Aug 4, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Two behaviors had no test at all in the fast tier. Asking for the
deprecated "fmm"/"fast_matrix_market" Matrix Market engine when
fast_matrix_market is not installed must warn about the deprecation
before it fails, and then fail with an ImportError naming the engine;
neither read nor write had coverage for that, since the existing engine
tests skip themselves when the package is missing. And the config
mapping's ipython_key_completions hook, which drives config[<tab>]
in IPython, was never called.
This PR moved to the bottom of the stack, onto main. Its two tests of
from_networkx's string-weight fallback stayed behind: that fallback comes
with #600, and #644 removes it and those tests.
Each test was checked by perturbing the line it covers and confirming
it goes red.
Added in the 2026-10-20 coverage round
Behavior fix: repeated indices in an imported csr, csc or GCXS array
(main too). A scipy csr or csc array outside canonical format, and a
pydata GCXS array, may repeat an index within a row (or column), and
from_scipy_sparse imported the arrays unchecked. The Matrix was invalid
(GxB_Matrix_fprint: GrB_INVALID_OBJECT), with nvals counting both entries.
Before: from_pydata_sparse of a 2x3 GCXS with indices [1, 1, 0] in row 0
(values 1, 2, 3) and [2] in row 1 gave nvals 4 with two (0, 1) entries,
and to_dense 2.0 at (0, 1), where pydata's todense gives 3.0.
from_scipy_sparse of the same csr array did the same.
After:
- from_scipy_sparse builds such an array through coo, so repeats need
dup_op, as they already did in coo input. Without it, a csr or csc with
a repeated index now raises ValueError "Duplicate indices found" instead
of building the invalid Matrix.
- from_pydata_sparse sums a GCXS's repeats by default, as pydata's todense
does (and its COO does when built), with scipy's sum_duplicates on a
copy, so the caller's arrays are unchanged and any dtype works. dup_op
combines them otherwise. A 1-d GCXS already summed them (through
asformat("coo")).
- Unsorted but distinct indices give the same Matrix as before.
New tests: test_from_scipy_sparse_compressed_duplicates (csr, csc) and
test_from_pydata_sparse_gcxs_duplicates (axis 0 and 1; int64, float64,
bool), which fail without the fix.
Stack created with GitHub Stacks CLI • Give Feedback 💬
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
codecov
Bot
commented
Oct 19, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.85%. Comparing base (00ec75b) to head (1e128f8).
Additional details and impacted files
@@ Coverage Diff @@
## main #609 +/- ##
==========================================
+ Coverage 98.78% 98.85% +0.07%
==========================================
Files 105 105
Lines 31192 31268 +76
Branches 3651 3657 +6
==========================================
+ Hits 30813 30910 +97
+ Misses 241 232 -9
+ Partials 138 126 -12
🚀 New features to boost your workflow:
- ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Two behaviors had no test at all in the fast tier. Asking for the
deprecated "fmm"/"fast_matrix_market" Matrix Market engine when
fast_matrix_market is not installed must warn about the deprecation
before it fails, and then fail with an ImportError naming the engine;
neither read nor write had coverage for that, since the existing engine
tests skip themselves when the package is missing. And the config
mapping's _ipython_key_completions_ hook, which drives `config[<tab>]`
in IPython, was never called.
Each test was checked by perturbing the line it covers and confirming
it goes red.
Behavior fix. A scipy csr or csc array outside canonical format, and a
pydata GCXS array, may repeat an index within a row (column), and
from_scipy_sparse imported the arrays unchecked. The Matrix was invalid
(GxB_Matrix_fprint: GrB_INVALID_OBJECT), with nvals counting both entries.
Before: from_pydata_sparse of a 2x3 GCXS with indices [1, 1, 0] in row 0
(values 1, 2, 3) and [2] in row 1 gave nvals 4 with two (0, 1) entries
and to_dense 2.0 at (0, 1), where pydata's todense gives 3.0.
from_scipy_sparse of the same csr array did the same.
After: from_scipy_sparse builds such an array through coo, so repeats
need dup_op as they do in coo input (ValueError "Duplicate indices
found" without it). from_pydata_sparse sums them by default (with
scipy's sum_duplicates, on a copy, so any dtype works), as pydata's
todense does and its COO does when built; dup_op combines them
otherwise. Unsorted but distinct indices give the same Matrix as before,
now built from coo. A 1-d GCXS already summed its repeats (through
asformat("coo")).
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|