test/test_rubypython.rb in rubypython-0.2.7 vs test/test_rubypython.rb in rubypython-0.2.8
- old
+ new
@@ -5,23 +5,23 @@
def setup
end
def test_simple
- assert RubyPython.start
- assert RubyPython.import "urllib"
- assert(RubyPython.stop)
- assert(!RubyPython.stop)
+ assert(RubyPython.start,"RubyPython failed to initialize.")
+ assert(RubyPython.import("urllib"), "urllib library import failed.")
+ assert(RubyPython.stop,"RubyPython failed to halt.")
+ assert(!RubyPython.stop,"RubyPython did not realize it had halted.")
end
def test_delegation
RubyPython.start
cPickle=RubyPython.import("cPickle")
assert_instance_of(RubyPythonBridge::RubyPyModule,cPickle)
- assert_equal(cPickle.loads("(dp1\nS'a'\nS'n'\ns(I1\nS'2'\ntp2\nI4\ns."),{"a"=>"n", [1, "2"]=>4})
+ assert_equal({"a"=>"n", [1, "2"]=>4},cPickle.loads("(dp1\nS'a'\nS'n'\ns(I1\nS'2'\ntp2\nI4\ns."))
dumped_array=cPickle.dumps([1,2,3,4])
- assert_equal(cPickle.loads(dumped_array),[1,2,3,4])
+ assert_equal([1,2,3,4],cPickle.loads(dumped_array))
assert_raise NoMethodError do
cPickle.splack
end
assert_instance_of(RubyPythonBridge::RubyPyClass,cPickle.PicklingError)
cPickle.free_pobj
@@ -36,11 +36,11 @@
RubyPython.import "cPickle"
RubyPython.import "urllib"
RubyPython.stop
end
- def test_propogate_python_errror
+ def test_propogate_python_error
RubyPython.start
assert_raise PythonError do
RubyPython.import "slasdfj"
end
RubyPython.stop
@@ -51,43 +51,43 @@
RubyPython.run do
cPickle=import "cPickle"
cPickle.inspect
unpickled=cPickle.loads("(dp1\nS'a'\nS'n'\ns(I1\nS'2'\ntp2\nI4\ns.")
end
- assert_equal(unpickled,{"a"=>"n", [1, "2"]=>4})
+ assert_equal({"a"=>"n", [1, "2"]=>4},unpickled)
assert(!RubyPython.stop)
end
def test_instance_method_delegation
RubyPython.start
wave=RubyPython.import "wave"
w=wave.open("test/test.wav","rb")
- assert_equal(w.getframerate,9600)
+ assert_equal(9600,w.getframerate)
w.close
RubyPython.stop
end
def test_pymain_delegation
RubyPython.start
- assert_equal(PyMain.float(42),42.to_f)
+ assert_equal(42.to_f,PyMain.float(42))
RubyPython.stop
end
def test_block_syntax
returned=""
RubyPython.start
returned=PyMain.float(22) do |f|
f*2
end
- assert_equal(returned,44.0)
+ assert_equal(44.0,returned)
RubyPython.stop
end
def test_session_function
RubyPython.session do
cPickle=RubyPython.import "cPickle"
cPickle.inspect
- assert_equal(cPickle.loads("(dp1\nS'a'\nS'n'\ns(I1\nS'2'\ntp2\nI4\ns."),{"a"=>"n", [1, "2"]=>4})
+ assert_equal({"a"=>"n", [1, "2"]=>4},cPickle.loads("(dp1\nS'a'\nS'n'\ns(I1\nS'2'\ntp2\nI4\ns."))
end
end
def test_setter_ary