Esempio n. 1
0
  def test_add(self):
    interface.add(simple, lambda arg1: arg1, dict(name='added'), [dict(name='arg1', type=int)])

    assert(interface.call('added arg1=1') == 1)

    assert(expect_exception(lambda: interface.call('added arg1=a'), HandledException))

    del simple.__ec_member__.Members['added'] # remove the added member
Esempio n. 2
0
  def test_custom(self):
    _type = custom(lambda v: v%2 == 1, int, type_str='an odd number')

    assert(_type(1) == 1)
    assert(expect_exception(lambda: _type(2), ValueError))
    assert(expect_exception(lambda: _type('a'), ValueError))
Esempio n. 3
0
 def test_unhandled_exception(self):
   assert(expect_exception(lambda: interface.call('ex'), ZeroDivisionError))
Esempio n. 4
0
 def test_handled_exception(self):
   assert(expect_exception(lambda: interface.call('task2'), HandledException))