%PDF- %PDF-
Direktori : /usr/local/lib/python2.7/test/ |
Current File : //usr/local/lib/python2.7/test/test_memoryview.pyo |
ó Nêáac @ s} d Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d l Z d d l Z d d l Z d d l Z d d d „ ƒ YZ d e f d „ ƒ YZ d d d „ ƒ YZ d d d „ ƒ YZ d d d „ ƒ YZ d e j e e f d „ ƒ YZ d e j e e f d „ ƒ YZ d e j e e f d „ ƒ YZ d e j f d „ ƒ YZ d „ Z e d k rye ƒ n d S( sT Unit tests for the memoryview XXX We need more tests! Some tests are in test_bytes iÿÿÿÿN( t test_supportt AbstractMemoryTestsc B s³ e Z d Z e d „ ƒ Z e d „ ƒ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z RS( t abcdefc C s | j S( N( t source_bytes( t self( ( s0 /usr/local/lib/python2.7/test/test_memoryview.pyt _source s c C s t d | j | j g ƒ S( N( t filtert Nonet ro_typet rw_type( R ( ( s0 /usr/local/lib/python2.7/test/test_memoryview.pyt _types s c s„ | j } | | j ƒ } t j | ƒ } | j | ƒ ‰ | j ˆ d | d ƒ ƒ | j ˆ d t ƒ | j ˆ d | d ƒ ƒ | j ˆ d | d ƒ ƒ | j ˆ d | d ƒ ƒ | j t ‡ f d † ƒ | j t ‡ f d † ƒ | j t ‡ f d † ƒ | j t ‡ f d † ƒ | j t ‡ f d † ƒ | j t ‡ f d † ƒ | j t ‡ f d † ƒ d ‰ | j t j | ƒ | ƒ d S( Ni t ai t fiÿÿÿÿiúÿÿÿc s ˆ d S( Ni ( ( ( t m( s0 /usr/local/lib/python2.7/test/test_memoryview.pyt <lambda>( t c s ˆ d S( Niùÿÿÿ( ( ( R ( s0 /usr/local/lib/python2.7/test/test_memoryview.pyR ) R c s ˆ t j S( N( t syst maxsize( ( R ( s0 /usr/local/lib/python2.7/test/test_memoryview.pyR * R c s ˆ t j S( N( R R ( ( R ( s0 /usr/local/lib/python2.7/test/test_memoryview.pyR + R c s ˆ d S( N( R ( ( R ( s0 /usr/local/lib/python2.7/test/test_memoryview.pyR - R c s ˆ d S( Ng ( ( ( R ( s0 /usr/local/lib/python2.7/test/test_memoryview.pyR . R c s ˆ d S( NR ( ( ( R ( s0 /usr/local/lib/python2.7/test/test_memoryview.pyR / R ( t getitem_typeR R t getrefcountt _viewt assertEqualt assertIsInstancet bytest assertRaisest IndexErrort TypeErrorR ( R t tpt itemt bt oldrefcount( ( R s0 /usr/local/lib/python2.7/test/test_memoryview.pyt check_getitem_with_type s$ c C s% x | j D] } | j | ƒ q Wd S( N( R R ( R R ( ( s0 /usr/local/lib/python2.7/test/test_memoryview.pyt test_getitem3 s c C so xh | j D]] } | | j ƒ } | j | ƒ } | j t | ƒ g t t | ƒ ƒ D] } | | ^ qP ƒ q Wd S( N( R R R R t listt ranget len( R R R R t i( ( s0 /usr/local/lib/python2.7/test/test_memoryview.pyt test_iter7 s c C sL xE | j D]: } | | j ƒ } | j | ƒ } | j | j ƒ t ƒ q Wd S( N( R R R R t __repr__t str( R R R R ( ( s0 /usr/local/lib/python2.7/test/test_memoryview.pyt test_repr= s c sº | j s | j d ƒ n | j | j ƒ } t j | ƒ } | j | ƒ ‰ ‡ f d † } | j t | d ƒ | j t | d ƒ | j t | t d ƒ ƒ d ‰ | j t j | ƒ | ƒ d S( Ns no read-only type to testc s | ˆ d <d S( Ni ( ( t value( R ( s0 /usr/local/lib/python2.7/test/test_memoryview.pyt setitemI s R iA ( R t skipTestR R R R R R t memoryviewR R ( R R R R* ( ( R s0 /usr/local/lib/python2.7/test/test_memoryview.pyt test_setitem_readonlyC s c s| | j s | j d ƒ n | j ‰ | j | j ƒ } t j | ƒ } | j | ƒ ‰ ˆ d ƒ ˆ d <| j ˆ | d ƒ ˆ d ƒ ˆ d d +| j ˆ | d ƒ ˆ d ƒ ˆ d d +| j ˆ | d ƒ ˆ d ƒ ˆ (| j ˆ | d ƒ ˆ d d !ˆ d d +| j ˆ | d ƒ ˆ d ƒ ˆ (ˆ d d !ˆ d d +| j ˆ | d ƒ ‡ ‡ f d † } | j t | d d ƒ | j t | d d ƒ | j t | t j d ƒ | j t | t j d ƒ | j t | d d ƒ | j t | d d ƒ | j t | d d ƒ | j t | d d ƒ | j t | d d ƒ | j t | t d d ƒ d ƒ | j t | t d d ƒ d ƒ d ‰ | j t j | ƒ | ƒ d S( Ns no writable type to testt 0i t 0bcdeft 12i i t 012defR R i i t cdedeft ababcfc s ˆ | ƒ ˆ | <d S( N( ( t keyR) ( R R ( s0 /usr/local/lib/python2.7/test/test_memoryview.pyR* h s i R iùÿÿÿg t ab( i ( R R+ R R R R t _check_contentsR R R R t ValueErrort sliceR R ( R R R R* ( ( R R s0 /usr/local/lib/python2.7/test/test_memoryview.pyt test_setitem_writableQ sB c C ss xl | j D]a } | | j ƒ } | j | ƒ } | j t ƒ | d =Wd QX| j t ƒ | d d 5Wd QXq Wd S( Ni i ( R R R R R ( R R R R ( ( s0 /usr/local/lib/python2.7/test/test_memoryview.pyt test_delitem| s c s{ xt ˆ j D]i } ˆ j | ˆ j ƒ ƒ } | j ƒ } d j ‡ f d † d Dƒ ƒ } ˆ j | | ƒ ˆ j | t ƒ q Wd S( NR c 3 s | ] } ˆ j | ƒ Vq d S( N( R ( t .0t c( R ( s0 /usr/local/lib/python2.7/test/test_memoryview.pys <genexpr>‹ s R ( R R R t tobytest joinR R R ( R R R R t expected( ( R s0 /usr/local/lib/python2.7/test/test_memoryview.pyt test_tobytes… s c C sU xN | j D]C } | j | | j ƒ ƒ } | j ƒ } | j | t t d ƒ ƒ q Wd S( NR ( R R R t tolistR t mapt ord( R R R t l( ( s0 /usr/local/lib/python2.7/test/test_memoryview.pyt test_tolist s c C s‚ x{| j D]p} | j | | j ƒ ƒ } x§ | j D]œ } | j | | d ƒ k ƒ | j | | d ƒ k ƒ | j | | d ƒ k ƒ | j | | d ƒ k ƒ | j | | d ƒ k ƒ | j | | d ƒ k ƒ q2 W| j | | k ƒ | j | | k ƒ | j | d d !| k ƒ | j | d d !| k ƒ | j | d k ƒ | j | d k ƒ | j d | k ƒ | j d | k ƒ q Wd S( NR t abcdet abcde1i i i u abcdef( R R R t assertTruet assertFalse( R R R t tp_comp( ( s0 /usr/local/lib/python2.7/test/test_memoryview.pyt test_compare• s"