def test_inconsistent_dims(self): with raises(InconsistentMatrixDimensions) as exc_info: from_string('''34 5 2 ''') assert_exc_info_msg( exc_info, 'Inconsistent columns in current row (1) ' 'from those in the first row (2)')
def test_lex_error(self): with raises(LexingError): from_string('ABCD')
def test_scientific_notation(self): assert from_string('''1.2e10 -22.2 10e2 -9.1e-3 1 5e-6''') == Matrix(3, 2, [1.2e10, -22.2, 10e2, -9.1e-3, 1, 5e-6])
def test_square(self): assert from_string('''11.7 52 -34 -12.2 ''') == Matrix(2, 2, [11.7, 52, -34, -12.2])
def test_single(self): assert from_string('34.2\n') == Matrix(1, 1, [34.2])
def test_empty(self): assert from_string('') == Matrix(0, 0, [])