Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r91556:e2b62fc32b15
Date: 2017-06-07 08:15 +0200
http://bitbucket.org/pypy/pypy/changeset/e2b62fc32b15/

Log:    Simplify and complete the tests

diff --git a/pypy/module/test_lib_pypy/ctypes_tests/test_array.py 
b/pypy/module/test_lib_pypy/ctypes_tests/test_array.py
--- a/pypy/module/test_lib_pypy/ctypes_tests/test_array.py
+++ b/pypy/module/test_lib_pypy/ctypes_tests/test_array.py
@@ -143,14 +143,18 @@
         A = c_char * 10
         TP = POINTER(A)
         x = TP(A())
-        assert repr(x[0]) != "''"
-        assert isinstance(repr(x[0]), bytes)
+        assert x[0] != ''
 
         A = c_wchar * 10
         TP = POINTER(A)
         x = TP(A())
-        assert repr(x[0]) != "''"
-        assert isinstance(repr(x[0]), bytes)
+        assert x[0] != ''
+
+    def test_output_simple_array(self):
+        A = c_char * 10
+        AA = A * 10
+        aa = AA()
+        assert aa[0] != ''
 
     def test_output_complex_test(self):
         class Car(Structure):
@@ -158,6 +162,7 @@
                         ("speed", c_float),
                         ("owner", c_char * 10)]
 
+        assert isinstance(Car("abcdefghi", 42.0, "12345").brand, bytes)
         assert Car("abcdefghi", 42.0, "12345").brand == "abcdefghi"
         assert Car("abcdefghio", 42.0, "12345").brand == "abcdefghio"
         raises(ValueError, Car, "abcdefghiop", 42.0, "12345")
@@ -165,12 +170,4 @@
         A = Car._fields_[2][1]
         TP = POINTER(A)
         x = TP(A())
-        assert repr(x[0]) != "''"
-        assert isinstance(repr(x[0]), bytes)
-
-        c = Car()
-        c.brand = "abcdex"
-        c.speed = 42.0
-        c.owner = "12345"
-        assert isinstance(repr(c.brand), bytes)
-        
+        assert x[0] != ''
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to