scikit-learn/scikit-learn — pull request #2883 by rafacarrascosa (2014-02-22 16:28:11+00:00)
Title: FIX ValueError was not being raised

len(indptr) is always greater that 0 because its initialized with non-empty list.
Because of that this branch is never taken and the ValueError never raised.

Aditionaly, (as VirgileFritsch) suggested the next "if" was subsumed in the "else" of the first.