vatlab / sos-julia

SoS extension for Julia
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

try to fix test #12

Open HenryLeongStat opened 5 years ago

HenryLeongStat commented 5 years ago
$ python test_julia_kernel.py
/Users/manchongleong/anaconda/lib/python3.6/site-packages/jupyter_client/manager.py:72: DeprecationWarning: KernelManager._kernel_name_changed is deprecated in traitlets 4.1: use @observe and @unobserve instead.
  def _kernel_name_changed(self, name, old, new):
.../Users/manchongleong/anaconda/lib/python3.6/importlib/_bootstrap.py:219: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
  return f(*args, **kwds)
.
----------------------------------------------------------------------
Ran 4 tests in 34.444s

OK

That should be more than 4 tests. Not sure what is going on.

BoPeng commented 5 years ago

Only functions with name def testXXXX will be considered as tests.

BoPeng commented 5 years ago

As a convention, let us do this for Julia and possibly all other language modules

def testIntToJulia(self):
    RUN: var=int_value
    RUN:  %use Julia
             %get var
    RUN type of var
    ASSERT type of var
    RUN value of var
    ASSERT value of var
    # restore to sos kernel
    RUN %use SoS

def testIntFromJulia(self):
    RUN %use Julia
    RUN  var = int
    RUN  %use SoS\n%get var --from Julia
    RUN dict var
    ASSERT values of var

Note that

  1. you can use multiple line statements to save calls, but magics have to be the first several lines
  2. On the other language side you have to use the native method to check the type and value
  3. On the SoS side dict makes it easier to check multiple values.

Edit: forget about var1, var2, let us use a test for a single value, like

testInt
testLongInt
testFloat
testDouble
testString
testStringWithBackSlash
HenryLeongStat commented 5 years ago
$ python test_julia_kernel.py
/Users/manchongleong/anaconda/lib/python3.6/site-packages/jupyter_client/manager.py:72: DeprecationWarning: KernelManager._kernel_name_changed is deprecated in traitlets 4.1: use @observe and @unobserve instead.
  def _kernel_name_changed(self, name, old, new):
./Users/manchongleong/anaconda/lib/python3.6/importlib/_bootstrap.py:219: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
  return f(*args, **kwds)
...............
----------------------------------------------------------------------
Ran 16 tests in 34.512s

OK