Author: Ronan Lamy <[email protected]>
Branch: py3k-update
Changeset: r84035:a03042e29c90
Date: 2016-04-29 19:38 +0100
http://bitbucket.org/pypy/pypy/changeset/a03042e29c90/

Log:    more test fixes

diff --git a/pypy/module/cpyext/test/test_frameobject.py 
b/pypy/module/cpyext/test/test_frameobject.py
--- a/pypy/module/cpyext/test/test_frameobject.py
+++ b/pypy/module/cpyext/test/test_frameobject.py
@@ -59,7 +59,7 @@
              """),
             ], prologue='#include "frameobject.h"')
         exc = raises(ValueError, module.raise_exception)
-        exc.value[0] == 'error message'
+        exc.value.args[0] == 'error message'
         if not self.runappdirect:
             frame = exc.traceback.tb_frame
             assert frame.f_code.co_filename == "filename"
@@ -75,7 +75,7 @@
              """
                  int check;
                  PyObject *type, *value, *tb;
-                 PyObject *ret = PyRun_String("XXX", Py_eval_input, 
+                 PyObject *ret = PyRun_String("XXX", Py_eval_input,
                                               Py_None, Py_None);
                  if (ret) {
                      Py_DECREF(ret);
diff --git a/pypy/module/cpyext/test/test_listobject.py 
b/pypy/module/cpyext/test/test_listobject.py
--- a/pypy/module/cpyext/test/test_listobject.py
+++ b/pypy/module/cpyext/test/test_listobject.py
@@ -19,13 +19,13 @@
 
         assert not api.PyList_Check(space.newtuple([]))
         assert not api.PyList_CheckExact(space.newtuple([]))
-    
+
     def test_get_size(self, space, api):
         l = api.PyList_New(0)
         assert api.PyList_GET_SIZE(l) == 0
         api.PyList_Append(l, space.wrap(3))
         assert api.PyList_GET_SIZE(l) == 1
-    
+
     def test_size(self, space, api):
         l = space.newlist([space.w_None, space.w_None])
         assert api.PyList_Size(l) == 2
@@ -42,12 +42,12 @@
         # insert at index -1: next-to-last
         assert api.PyList_Insert(w_l, -1, space.wrap(3)) == 0
         assert space.unwrap(api.PyList_GetItem(w_l, 3)) == 3
-    
+
     def test_sort(self, space, api):
         l = space.newlist([space.wrap(1), space.wrap(0), space.wrap(7000)])
         assert api.PyList_Sort(l) == 0
         assert space.eq_w(l, space.newlist([space.wrap(0), space.wrap(1), 
space.wrap(7000)]))
-    
+
     def test_reverse(self, space, api):
         l = space.newlist([space.wrap(3), space.wrap(2), space.wrap(1)])
         assert api.PyList_Reverse(l) == 0
@@ -117,9 +117,9 @@
         l = L([1])
         module.setlistitem(l, 0)
         assert len(l) == 1
-        
+
         raises(SystemError, module.setlistitem, (1, 2, 3), 0)
-    
+
         l = []
         module.appendlist(l, 14)
         assert len(l) == 1
@@ -144,7 +144,7 @@
                 PyObject* o, *o2, *o3;
                 o = PyList_New(1);
 
-                o2 = PyInt_FromLong(0);
+                o2 = PyLong_FromLong(0);
                 PyList_SET_ITEM(o, 0, o2);
                 o2 = NULL;
 
diff --git a/pypy/module/cpyext/test/test_pyfile.py 
b/pypy/module/cpyext/test/test_pyfile.py
--- a/pypy/module/cpyext/test/test_pyfile.py
+++ b/pypy/module/cpyext/test/test_pyfile.py
@@ -1,7 +1,6 @@
-from pypy.module.cpyext.api import fopen, fclose, fwrite
 from pypy.module.cpyext.test.test_api import BaseApiTest
 from pypy.module.cpyext.object import Py_PRINT_RAW
-from rpython.rtyper.lltypesystem import rffi, lltype
+from rpython.rtyper.lltypesystem import rffi
 from rpython.tool.udir import udir
 import pytest
 
@@ -56,18 +55,6 @@
                 w_file = api.PyFile_FromString(filename, mode)
         assert space.str_w(api.PyFile_Name(w_file)) == name
 
-    def test_file_fromfile(self, space, api):
-        name = str(udir / "_test_file")
-        with rffi.scoped_str2charp(name) as filename:
-            with rffi.scoped_str2charp("wb") as mode:
-                w_file = api.PyFile_FromString(filename, mode)
-                fp = api.PyFile_AsFile(w_file)
-                assert fp is not None
-                w_file2 = api.PyFile_FromFile(fp, filename, mode, None)
-        assert w_file2 is not None
-        assert api.PyFile_Check(w_file2)
-        assert space.str_w(api.PyFile_Name(w_file2)) == name
-
     @pytest.mark.xfail
     def test_file_setbufsize(self, space, api):
         api.PyFile_SetBufSize()
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to