From fd784743a084cc63807aa3cb6d22ce0a501f6787 Mon Sep 17 00:00:00 2001 From: Shefali-Pandey <38816933+Shefali-Pandey@users.noreply.github.com> Date: Sat, 6 Oct 2018 04:58:39 +0530 Subject: [PATCH] Update rpy_test.rb --- trunk/test/rpy_test.rb | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/trunk/test/rpy_test.rb b/trunk/test/rpy_test.rb index ae79f1e..3a8bee9 100644 --- a/trunk/test/rpy_test.rb +++ b/trunk/test/rpy_test.rb @@ -2,38 +2,26 @@ require 'test/unit' $:.unshift File.join(File.dirname(__FILE__), "..", "lib") require 'rpy' - +main() class TestPython < Test::Unit::TestCase - def test_python_no_return Py.start # starts the python interperter - output = "hello world" - Py.run( %Q(print "#{output}"), {} ) - Py.stop # stops the interperter end - def test_python_yaml_return Py.start - result = YAML.load( Py.run( %Q(_rpython_result = {'hello':1,'world':2}), :serialize => 'yaml') ) - assert_equal 1, result['hello'] assert_equal 2, result['world'] - Py.stop end - - def test_benchmark Py.start - py_result = "" iterations = 100 real_times = [] - iterations.times do timer = Time.now py_result = Py.run( %Q(_rpython_result = {'hello':1,'world':2}), :serialize => 'yaml') @@ -50,17 +38,13 @@ def test_benchmark variance = variance + delta * (time - average) total += time end - variance /= n - puts "total: #{total} seconds, average: #{average} seconds, variance: #{variance} seconds" - result = YAML.load( py_result ) assert_equal 1, result['hello'] assert_equal 2, result['world'] - - Py.stop end - end +if __name__== '__main__': + main()