File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -601,6 +601,24 @@ def check_equal(view, is_equal):
601601 m2 = m .cast ('@' + m .format )
602602 check_equal (m2 , True )
603603
604+ # Test 'c' format
605+ a = array .array ('B' , [1 , 2 , 3 ])
606+ m = memoryview (a .tobytes ()).cast ('c' )
607+ check_equal (m , True )
608+
609+ # Test 'n' and 'N' formats
610+ if struct .calcsize ('L' ) == struct .calcsize ('N' ):
611+ int_format = 'L'
612+ elif struct .calcsize ('Q' ) == struct .calcsize ('N' ):
613+ int_format = 'Q'
614+ else :
615+ raise ValueError ('unable to get size_t format in struct' )
616+ a = array .array (int_format , [1 , 2 , 3 ])
617+ m = memoryview (a .tobytes ()).cast ('N' )
618+ check_equal (m , True )
619+ m = memoryview (a .tobytes ()).cast ('n' )
620+ check_equal (m , True )
621+
604622 # Test '?' format
605623 m = memoryview (b'\0 \1 \2 ' ).cast ('?' )
606624 check_equal (m , True )
You can’t perform that action at this time.
0 commit comments