Commits

Brian Kearns committed d88001e

cleanups

  • Participants
  • Parent commits 90f4876

Comments (0)

Files changed (3)

File pypy/interpreter/buffer.py

             assert 0 <= start <= stop
             return self.value[start:stop]
         return "".join([self.value[start + i*step] for i in xrange(size)])
+# ____________________________________________________________
 
-# ____________________________________________________________
 
 class SubBufferMixin(object):
     _attrs_ = ['buffer', 'offset', 'size']
         if start == stop:
             return ''     # otherwise, adding self.offset might make them
                           # out of bounds
-        return self.buffer.getslice(self.offset + start, self.offset + stop, step, size)
+        return self.buffer.getslice(self.offset + start, self.offset + stop,
+                                    step, size)
 
 
 class SubBuffer(Buffer):

File pypy/module/array/test/test_array.py

 import sys
-import py
-import py.test
-
-
-## class AppTestSimpleArray:
-##     spaceconfig = dict(usemodules=('array',))
-##     def setup_class(cls):
-##         cls.w_simple_array = cls.space.appexec([], """():
-##             import array
-##             return array.simple_array
-##         """)
-
-##     def test_simple(self):
-##         a = self.simple_array(10)
-##         a[5] = 7.42
-##         assert a[5] == 7.42
+import pytest
 
 
 class BaseArrayTests:
-
-
     def test_ctor(self):
         assert len(self.array('c')) == 0
         assert len(self.array('i')) == 0
         assert not a > 2*a
         assert not a >= 2*a
 
-
     def test_reduce(self):
         import pickle
         a = self.array('i', [1, 2, 3])
 
         assert img[3, 25] == 3 * 9
 
-
     def test_override_from(self):
         class mya(self.array):
             def fromlist(self, lst):
 
     def test_assign_object_with_special_methods(self):
         from array import array
-        
+
         class Num(object):
             def __float__(self):
                 return 5.25
-                
+
             def __int__(self):
                 return 7
-                
+
         class NotNum(object):
             pass
-        
+
         class Silly(object):
             def __float__(self):
                 return None
-                
+
             def __int__(self):
-                return None         
+                return None
 
         class OldNum:
             def __float__(self):
                 return 6.25
-                
+
             def __int__(self):
                 return 8
-                
+
         class OldNotNum:
             pass
-        
+
         class OldSilly:
             def __float__(self):
                 return None
-                
+
             def __int__(self):
                 return None
-                
+
         for tc in 'bBhHiIlL':
             a = array(tc, [0])
             raises(TypeError, a.__setitem__, 0, 1.0)
             a = array(tc, [0])
             a[0] = 1.0
             a[0] = 1
-            a[0] = Num()        
+            a[0] = Num()
             assert a[0] == 5.25
             raises(TypeError, a.__setitem__, NotNum())
             a[0] = OldNum()
             raises(TypeError, a.__setitem__, OldNotNum())
             raises(TypeError, a.__setitem__, Silly())
             raises(TypeError, a.__setitem__, OldSilly())
-            
+
         a = array('c', 'hi')
         a[0] = 'b'
         assert a[0] == 'b'
-            
+
         a = array('u', u'hi')
         a[0] = u'b'
         assert a[0] == u'b'
-        
+
 
 class TestCPythonsOwnArray(BaseArrayTests):
-
     def setup_class(cls):
         import array
         cls.array = array.array
         import struct
         cls.struct = struct
-        cls.tempfile = str(py.test.ensuretemp('array').join('tmpfile'))
+        cls.tempfile = str(pytest.ensuretemp('array').join('tmpfile'))
         cls.maxint = sys.maxint
 
 
             return array.array
         """)
         cls.w_tempfile = cls.space.wrap(
-            str(py.test.ensuretemp('array').join('tmpfile')))
+            str(pytest.ensuretemp('array').join('tmpfile')))
         cls.w_maxint = cls.space.wrap(sys.maxint)
 
     def test_buffer_info(self):
 
     def test_getitem_only_ints(self):
         class MyInt(object):
-          def __init__(self, x):
-            self.x = x
+            def __init__(self, x):
+                self.x = x
 
-          def __int__(self):
-            return self.x
+            def __int__(self):
+                return self.x
 
         a = self.array('i', [1, 2, 3, 4, 5, 6])
         raises(TypeError, "a[MyInt(0)]")
 class AppTestArrayBuiltinShortcut(AppTestArray):
     spaceconfig = AppTestArray.spaceconfig.copy()
     spaceconfig['objspace.std.builtinshortcut'] = True
-

File pypy/module/cpyext/test/test_arraymodule.py

 from pypy.module.cpyext.test.test_cpyext import AppTestCpythonExtensionBase
 
-import py
-import sys
 
 class AppTestArrayModule(AppTestCpythonExtensionBase):
     enable_leak_checking = False
         module = self.import_module(name='array')
         arr = module.array('i', [1,2,3])
         sum = 0
-        for i in arr: 
+        for i in arr:
             sum += i
         assert sum == 6
 
                                     '\x02\0\0\0'
                                     '\x03\0\0\0'
                                     '\x04\0\0\0')
-