File: test_exceptions.py

package info (click to toggle)
python-suitesparse-graphblas 7.4.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 956 kB
  • sloc: ansic: 9,939; python: 3,575; sh: 52; makefile: 13
file content (12 lines) | stat: -rw-r--r-- 370 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
import pytest

from suitesparse_graphblas import check_status, exceptions, ffi, lib


def test_check_status():
    A = ffi.new("GrB_Matrix*")
    check_status(A, lib.GrB_Matrix_new(A, lib.GrB_BOOL, 2, 2))
    with pytest.raises(exceptions.Panic):
        check_status(A, lib.GrB_PANIC)
    with pytest.raises(exceptions.Panic):
        check_status(A[0], lib.GrB_PANIC)