Commits

raineszm committed 89198e3

Added some actual specs for legacy mode.

  • Participants
  • Parent commits 3521dc7

Comments (0)

Files changed (1)

File spec/legacy_spec.rb

 
   before do
     RubyPython.start
+    sys = RubyPython.import 'sys'
+    path = sys.path
+    path.push './spec/python_helpers'
+    sys.path = path
+    @objects = RubyPython.import 'objects'
   end
 
   after do
     it "should enable legacy mode" do
       RubyPython.legacy_mode.should == true
     end
+
+    [
+      ["an int", "an int", AnInt],
+      ["a float", "a float", AFloat],
+      ["a string", "a string", AString],
+      ["a list", "an array", AnArray],
+      ["a tuple", "an array", AnArray],
+      ["a dict", "a hash", AConvertedHash],
+      ["python True", "true", true],
+      ["python False", "false", false],
+      ["python None", "nil", nil]
+    ].each do |py_type, rb_type, output|
+      it "should implicitly convert #{py_type} to #{rb_type}" do
+        @objects.__send__(py_type.sub(' ', '_')).should == output
+      end
+    end
   end
 
 end