Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Create SageObJectTest
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasdiez committed Dec 26, 2020
1 parent d1f14f0 commit f4a0c4a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/sage/numerical/backends/cvxopt_backend_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TestCVXOPTBackend(GenericBackendTests):
def backend(self) -> GenericBackend:
return MixedIntegerLinearProgram(solver="CVXOPT").get_backend()

def test_sage_unittest_testsuite(self, backend: GenericBackend):
def test_sage_unittest_testsuite(self, sage_object: SageObject):
# TODO: Remove this test as soon as all old test methods are migrated
from sage.misc.sage_unittest import TestSuite
TestSuite(backend).run(verbose=True, raise_on_failure=True, skip=("_test_pickling","_test_solve","_test_solve_trac_18572"))
TestSuite(sage_object).run(verbose=True, raise_on_failure=True, skip=("_test_pickling","_test_solve","_test_solve_trac_18572"))
14 changes: 10 additions & 4 deletions src/sage/numerical/backends/generic_backend_test.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import pytest
from .generic_backend import GenericBackend
from sage.structure.sage_object import SageObject
from sage.structure.sage_object_test import SageObjectTests

class GenericBackendTests:
class GenericBackendTests(SageObjectTests):

@pytest.fixture
def backend(self) -> GenericBackend:
def backend(self, *args, **kwargs) -> GenericBackend:
raise NotImplementedError

@pytest.fixture
def sage_object(self, backend) -> SageObject:
return backend

def test_ncols_nonnegative(self, backend: GenericBackend):
assert backend.ncols() >= 0

def test_sage_unittest_testsuite(self, backend: GenericBackend):
def test_sage_unittest_testsuite(self, sage_object: SageObject):
# TODO: Remove this test as soon as all old test methods are migrated
from sage.misc.sage_unittest import TestSuite
TestSuite(backend).run(verbose=True, raise_on_failure=True, skip="_test_pickling")
TestSuite(sage_object).run(verbose=True, raise_on_failure=True, skip="_test_pickling")
14 changes: 14 additions & 0 deletions src/sage/structure/sage_object_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

import pytest
from .sage_object import SageObject

class SageObjectTests:

@pytest.fixture
def sage_object(self, *args, **kwargs) -> SageObject:
raise NotImplementedError

def test_sage_unittest_testsuite(self, sage_object: SageObject):
# TODO: Remove this test as soon as all old test methods are migrated
from sage.misc.sage_unittest import TestSuite
TestSuite(sage_object).run(verbose=True, raise_on_failure=True)

0 comments on commit f4a0c4a

Please sign in to comment.