How to use the swat.SWATError function in swat

To help you get started, we’ve selected a few swat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sassoftware / sasoptpy / tests / abstract / statement / test_create_data.py View on Github external
def setUpClass(cls):
        so.reset()
        cls.conn = None
        from swat import CAS, SWATError
        try:
            cls.conn = create_cas_connection()
        except SWATError:
            warnings.warn('CAS connection is not available', RuntimeWarning)
        except TypeError:
            warnings.warn('CAS variables are not available', RuntimeWarning)
github sassoftware / sasoptpy / tests / examples / test_examples.py View on Github external
def setUpClass(cls):
        cls.conn = None
        from swat import CAS, SWATError
        try:
            cls.conn = create_cas_connection()
            cls.defstdout = sys.stdout
        except SWATError:
            raise unittest.SkipTest('Cannot establish CAS connection. ' \
                  + 'Check your environment variables ' \
                  + '(CASHOST, CASPORT, AUTHINFO)')
        except TypeError:
            raise unittest.SkipTest('Environment variable may not be defined')
github sassoftware / sasoptpy / tests / abstract / statement / test_assignment.py View on Github external
def setUpClass(cls):
        so.reset()
        cls.conn = None
        from swat import CAS, SWATError
        try:
            cls.conn = create_cas_connection()
        except SWATError:
            warnings.warn('CAS connection is not available', RuntimeWarning)
        except TypeError:
            warnings.warn('CAS variables are not available', RuntimeWarning)
github sassoftware / sasoptpy / tests / interface / test_cas_interface.py View on Github external
m.set_objective(x + 1.1 * y, sense=minimize, name='obj2')
        m.solve(mps=True, primalin=True)
        self.assertEqual(
            session.CASTable('PRIMALINTABLE').to_frame().to_string(), cleandoc(
                '''
                  _VAR_  _VALUE_
                0     x      6.0
                1     y      2.0
                '''
            ))

        # Drop option
        m.solve(mps=True, primalin=True, drop=True)
        def deleted_table():
            s = session.CASTable('PRIMALINTABLE').to_frame()
        self.assertRaises(SWATError, deleted_table)
github sassoftware / sasoptpy / tests / interface / test_cas_interface.py View on Github external
def setUpClass(cls):
        so.reset()
        cls.conn = None
        try:
            cls.conn = create_cas_connection()
        except SWATError:
            warnings.warn('CAS connection is not available', RuntimeWarning)
        except TypeError:
            warnings.warn('CAS variables are not available', RuntimeWarning)
github sassoftware / sasoptpy / tests / session / test_workspace.py View on Github external
def setUpClass(cls):
        so.reset()
        cls.conn = None
        try:
            cls.conn = create_cas_connection()
        except SWATError:
            warnings.warn('CAS connection is not available', RuntimeWarning)
        except TypeError:
            warnings.warn('CAS variables are not available', RuntimeWarning)
github sassoftware / sasoptpy / tests / abstract / statement / test_read_data.py View on Github external
def setUpClass(cls):
        so.reset()
        cls.conn = None
        from swat import CAS, SWATError
        try:
            cls.conn = create_cas_connection()
        except SWATError:
            warnings.warn('CAS connection is not available', RuntimeWarning)
        except TypeError:
            warnings.warn('CAS variables are not available', RuntimeWarning)
github sassoftware / sasoptpy / tests / abstract / statement / test_solve.py View on Github external
def setUpClass(cls):
        so.reset()
        cls.conn = None
        from swat import CAS, SWATError
        try:
            cls.conn = create_cas_connection()
        except SWATError:
            warnings.warn('CAS connection is not available', RuntimeWarning)
        except TypeError:
            warnings.warn('CAS variables are not available', RuntimeWarning)
github sassoftware / sasoptpy / tests / abstract / test_set_iterator.py View on Github external
def setUpClass(cls):
        so.reset()
        cls.conn = None
        from swat import CAS, SWATError
        try:
            cls.conn = create_cas_connection()
        except SWATError:
            warnings.warn('CAS connection is not available', RuntimeWarning)
        except TypeError:
            warnings.warn('CAS variables are not available', RuntimeWarning)
github sassoftware / sasoptpy / tests / core / test_model.py View on Github external
def setUpClass(cls):
        cls.conn = None
        from swat import CAS, SWATError
        try:
            cls.conn = create_cas_connection()
        except SWATError:
            warnings.warn('CAS connection is not available',
                          RuntimeWarning)
        except TypeError:
            warnings.warn('CAS variables are not available',
                          RuntimeWarning)