Exemplo n.º 1
0
from __future__ import absolute_import, print_function
import os

import numpy as np
import numpy.testing as test

from scilab2py import Scilab2Py, scilab
from scilab2py.compat import unicode

THIS_DIR = os.path.abspath(os.path.dirname(__file__)).replace('\\', '/')
scilab.exit()


class IncomingTest(test.TestCase):

    """Test the importing of all Scilab data types, checking their type

    Uses test_datatypes.sci to read in a dictionary with all Scilab types
    Tests the types of all the values to make sure they were
        brought in properly.

    """
    @classmethod
    def setUpClass(cls):
        with Scilab2Py() as sci:
            sci.getd(THIS_DIR)
            cls.data = sci.test_datatypes()

    def helper(self, base, keys, types):
        """
        Perform type checking of the values
Exemplo n.º 2
0
from __future__ import absolute_import, print_function
import os
import pickle

import numpy as np
import numpy.testing as test

from scilab2py import Scilab2Py, Scilab2PyError, scilab
from scilab2py.utils import Struct

THIS_DIR = os.path.abspath(os.path.dirname(__file__))
scilab.exit()


class BasicUsageTest(test.TestCase):
    """Excercise the basic interface of the package
    """
    def setUp(self):
        self.sci = Scilab2Py()
        self.sci.getd(THIS_DIR)

    def tearDown(self):
        self.sci.exit()

    def test_run(self):
        """Test the run command
        """
        self.sci.eval('y=ones(3,3)')
        y = self.sci.pull('y')
        desired = np.ones((3, 3))
        test.assert_allclose(y, desired)