Sha256: 80b7bf01869f25abfe6d963726bed3c1845d3805653c49a5b9bc9935a6bc9a11
Contents?: true
Size: 1.35 KB
Versions: 12
Compression:
Stored size: 1.35 KB
Contents
require File.dirname(__FILE__) + '/spec_helper.rb' describe RubyPython::PythonError do def cause_error RubyPython::Python.PyImport_ImportModule("wat") end describe "#error?" do it "should return false when no error has occured" do described_class.error?.should be_false end it "should return true when an error has occured" do cause_error described_class.error?.should be_true end end describe "#clear" do it "should reset the Python error flag" do cause_error described_class.clear described_class.error?.should be_false end it "should not barf when there is no error" do lambda {described_class.clear}.should_not raise_exception end end describe "#fetch" do it "should make availible Python error type" do cause_error rbType, rbValue, rbTraceback = described_class.fetch rbType.getAttr("__name__").rubify.should == "ImportError" end end describe ".last_traceback" do it "should make availble the Python traceback of the last error" do traceback = RubyPython.import 'traceback' errors = RubyPython.import 'errors' begin errors.nested_error rescue RubyPython::PythonError => exc tb = exc.traceback list = traceback.format_tb(tb) list.rubify[0].should =~ /1 \/ 0/ end end end end
Version data entries
12 entries across 12 versions & 3 rubygems