Project import/python3-xlib - Diff 826154ccd0...cc1e1eafd7

... ... --- a/.abf.yml
... ... +++ b/.abf.yml
... ... @@ -1,2 +1,3 @@
1 1
sources:
2 2
  python-xlib-0.15rc1.tar.bz2: 30b85f1e2e398f75794cf8d36be9f34420436cf0
3
  python-xlib-0.17.tar.gz: be6caa35d0c67e3d9a0f4e59040cf146d9d06ec5
view file @ cc1e1eafd7
... ... index 168da3a..427371f 100644
... ... --- a/python-xlib-0.15rc1-fix-rhomboid-examples.patch
... ... +++ b/fix-rhomboid-examples.patch
... ... @@ -1,17 +1,23 @@
1
Index: trunk/examples/draw.py
2
===================================================================
3
--- trunk.orig/examples/draw.py	2009-04-11 19:18:15.000000000 -0400
4
+++ trunk/examples/draw.py	2009-11-05 06:06:25.000000000 -0500
5
@@ -115,7 +115,7 @@
6
                         sys.exit(0)
1
commit c58d9d6e26a323e1525fb5683a0e3fbe1eee9c22
2
Author: Orion Poplawski <orion@cora.nwra.com>
3
Date:   Fri Sep 30 15:49:39 2016 -0600
4
5
    Fix spelling of rhomboid
6
7
diff --git a/examples/draw-proto.py b/examples/draw-proto.py
8
index 3db1b99..4edc361 100755
9
--- a/examples/draw-proto.py
10
+++ b/examples/draw-proto.py
11
@@ -107,7 +107,7 @@ class Window(object):
12
                 current.motion(e)
7 13
 
8 14
 # A drawed objects, consisting of either a single
9 15
-# romboid, or two romboids connected by a winding line
10 16
+# rhomboid, or two rhomboids connected by a winding line
11 17
 
12
 class Movement:
18
 class Movement(object):
13 19
     def __init__(self, win, ev):
14
@@ -129,7 +129,7 @@
20
@@ -121,7 +121,7 @@ class Movement(object):
15 21
         self.time = ev.time
16 22
         self.lines = [(ev.event_x, ev.event_y)]
17 23
 
... ... @@ -20,7 +26,7 @@ Index: trunk/examples/draw.py
26 26
         self.last = None
27 27
 
28 28
     def motion(self, ev):
29
@@ -182,7 +182,7 @@
29
@@ -182,7 +182,7 @@ class Movement(object):
30 30
     def finish(self, ev):
31 31
         self.motion(ev)
32 32
         if len(self.lines) > 1:
... ... @@ -29,40 +35,40 @@ Index: trunk/examples/draw.py
35 35
 
36 36
             self.left = min(ev.event_x - 5, self.left)
37 37
             self.right = max(ev.event_x + 5, self.right)
38
@@ -204,8 +204,8 @@
38
@@ -206,8 +206,8 @@ class Movement(object):
39 39
                 self.last.draw()
40 40
 
41 41
 
42 42
-# A romboid, drawed around the Movement endpoints
43
-class Romboid:
43
-class Romboid(object):
44 44
+# A rhomboid, drawed around the Movement endpoints
45
+class Rhomboid:
45
+class Rhomboid(object):
46 46
     def __init__(self, win, ev):
47 47
         self.win = win
48 48
         self.x = ev.event_x
49
@@ -213,7 +213,7 @@
49
@@ -215,7 +215,7 @@ class Romboid(object):
50 50
         self.draw()
51 51
 
52 52
     def draw(self):
53 53
-        # Draw the segments of the romboid
54 54
+        # Draw the segments of the rhomboid
55
         self.win.window.poly_line(self.win.gc, X.CoordModePrevious,
56
                                   [(self.x, self.y - 5),
57
                                    (5, 5),
58
Index: trunk/examples/draw-proto.py
59
===================================================================
60
--- trunk.orig/examples/draw-proto.py	2009-04-11 19:18:15.000000000 -0400
61
+++ trunk/examples/draw-proto.py	2009-11-05 06:06:25.000000000 -0500
62
@@ -104,7 +104,7 @@
63
                 current.motion(e)
55
         PolyLine(self.win.d, None,
56
                  X.CoordModePrevious,
57
                  self.win.window,
58
diff --git a/examples/draw.py b/examples/draw.py
59
index 8832a50..f456d80 100755
60
--- a/examples/draw.py
61
+++ b/examples/draw.py
62
@@ -118,7 +118,7 @@ class Window(object):
63
                         sys.exit(0)
64 64
 
65 65
 # A drawed objects, consisting of either a single
66 66
-# romboid, or two romboids connected by a winding line
67 67
+# rhomboid, or two rhomboids connected by a winding line
68 68
 
69
 class Movement:
69
 class Movement(object):
70 70
     def __init__(self, win, ev):
71
@@ -118,7 +118,7 @@
71
@@ -132,7 +132,7 @@ class Movement(object):
72 72
         self.time = ev.time
73 73
         self.lines = [(ev.event_x, ev.event_y)]
74 74
 
... ... @@ -71,7 +77,7 @@ Index: trunk/examples/draw-proto.py
77 77
         self.last = None
78 78
 
79 79
     def motion(self, ev):
80
@@ -179,7 +179,7 @@
80
@@ -185,7 +185,7 @@ class Movement(object):
81 81
     def finish(self, ev):
82 82
         self.motion(ev)
83 83
         if len(self.lines) > 1:
... ... @@ -80,23 +86,23 @@ Index: trunk/examples/draw-proto.py
86 86
 
87 87
             self.left = min(ev.event_x - 5, self.left)
88 88
             self.right = max(ev.event_x + 5, self.right)
89
@@ -203,8 +203,8 @@
89
@@ -207,8 +207,8 @@ class Movement(object):
90 90
                 self.last.draw()
91 91
 
92 92
 
93 93
-# A romboid, drawed around the Movement endpoints
94
-class Romboid:
94
-class Romboid(object):
95 95
+# A rhomboid, drawed around the Movement endpoints
96
+class Rhomboid:
96
+class Rhomboid(object):
97 97
     def __init__(self, win, ev):
98 98
         self.win = win
99 99
         self.x = ev.event_x
100
@@ -212,7 +212,7 @@
100
@@ -216,7 +216,7 @@ class Romboid(object):
101 101
         self.draw()
102 102
 
103 103
     def draw(self):
104 104
-        # Draw the segments of the romboid
105 105
+        # Draw the segments of the rhomboid
106
         PolyLine(self.win.d, None,
107
                  X.CoordModePrevious,
108
                  self.win.window,
106
         self.win.window.poly_line(self.win.gc, X.CoordModePrevious,
107
                                   [(self.x, self.y - 5),
108
                                    (5, 5),
view file @ cc1e1eafd7
... ... --- /dev/null
... ... +++ b/fix-ssh-tunnel-auth.patch
... ... @@ -0,0 +1,48 @@
1
Index: trunk/Xlib/support/unix_connect.py
2
===================================================================
3
--- trunk.orig/Xlib/support/unix_connect.py	2009-11-05 06:06:09.000000000 -0500
4
+++ trunk/Xlib/support/unix_connect.py	2009-11-05 06:06:23.000000000 -0500
5
@@ -161,6 +161,14 @@
6
     except os.error:
7
         pass
8
 
9
+    if not auth_data and host=='localhost':
10
+	# 127.0.0.1 counts as FamilyLocal, not FamilyInternet
11
+	# See Xtransutil.c:ConvertAddress.
12
+	# There might be more ways to spell 127.0.0.1 but
13
+	# 'localhost', yet this code fixes a the case of
14
+	# OpenSSH tunneling X.
15
+	return get_auth('unix:%d' % dno, 'unix', dno)
16
+
17
     return auth_name, auth_data
18
 
19
 get_auth = new_get_auth
20
commit 95e9996cf86b08fa5af12190b71dd9067cc85270
21
Author: Orion Poplawski <orion@cora.nwra.com>
22
Date:   Fri Sep 30 16:05:28 2016 -0600
23
24
    Replace tabs with spaces
25
26
diff --git a/Xlib/support/unix_connect.py b/Xlib/support/unix_connect.py
27
index 677c36e..c1a2201 100644
28
--- a/Xlib/support/unix_connect.py
29
+++ b/Xlib/support/unix_connect.py
30
@@ -168,12 +168,12 @@ def old_get_auth(sock, dname, host, dno):
31
         pass
32
 
33
     if not auth_data and host=='localhost':
34
-	# 127.0.0.1 counts as FamilyLocal, not FamilyInternet
35
-	# See Xtransutil.c:ConvertAddress.
36
-	# There might be more ways to spell 127.0.0.1 but
37
-	# 'localhost', yet this code fixes a the case of
38
-	# OpenSSH tunneling X.
39
-	return get_auth('unix:%d' % dno, 'unix', dno)
40
+        # 127.0.0.1 counts as FamilyLocal, not FamilyInternet
41
+        # See Xtransutil.c:ConvertAddress.
42
+        # There might be more ways to spell 127.0.0.1 but
43
+        # 'localhost', yet this code fixes a the case of
44
+        # OpenSSH tunneling X.
45
+        return get_auth('unix:%d' % dno, 'unix', dno)
46
 
47
     return auth_name, auth_data
48
 
view file @ cc1e1eafd7
...... file renamed without changes
view file @ cc1e1eafd7
... ... --- /dev/null
... ... +++ b/increase-receiving-buffer.patch
... ... @@ -0,0 +1,22 @@
1
commit 79c2f5a67d950a99948921fcc2a28b81856de3cc
2
Author: Orion Poplawski <orion@cora.nwra.com>
3
Date:   Fri Sep 30 15:37:24 2016 -0600
4
5
    Increate receiving buffer to 4096 bytes
6
    
7
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=357507
8
    https://bugzilla.redhat.com/show_bug.cgi?id=537264
9
10
diff --git a/Xlib/protocol/display.py b/Xlib/protocol/display.py
11
index 566c044..916269f 100644
12
--- a/Xlib/protocol/display.py
13
+++ b/Xlib/protocol/display.py
14
@@ -562,7 +562,7 @@ class Display(object):
15
                 # We're the recieving thread, parse the data
16
                 if recieving:
17
                     try:
18
-                        bytes_recv = self.socket.recv(2048)
19
+                        bytes_recv = self.socket.recv(4096)
20
                     except socket.error as err:
21
                         self.close_internal('server: %s' % err[1])
22
                         raise self.socket_error
view file @ 826154ccd0
... ... --- a/python-xlib-0.14-buffsize.patch
... ... +++ /dev/null
... ... @@ -1,12 +0,0 @@
0
diff -p -up python-xlib-0.14/Xlib/protocol/display.py.buffsize python-xlib-0.14/Xlib/protocol/display.py
1
--- python-xlib-0.14/Xlib/protocol/display.py.buffsize	2007-06-10 16:11:58.000000000 +0200
2
+++ python-xlib-0.14/Xlib/protocol/display.py	2008-03-02 16:33:57.000000000 +0100
3
@@ -534,7 +534,7 @@ class Display:
4
                 # We're the recieving thread, parse the data
5
                 if recieving:
6
                     try:
7
-                        bytes_recv = self.socket.recv(2048)
8
+                        bytes_recv = self.socket.recv(4096)
9
                     except socket.error as err:
10
                         self.close_internal('server: %s' % err[1])
11
                         raise self.socket_error
view file @ 826154ccd0
... ... --- a/python-xlib-0.15rc1-fix-ssh-tunnel-auth.patch
... ... +++ /dev/null
... ... @@ -1,19 +0,0 @@
0
Index: trunk/Xlib/support/unix_connect.py
1
===================================================================
2
--- trunk.orig/Xlib/support/unix_connect.py	2009-11-05 06:06:09.000000000 -0500
3
+++ trunk/Xlib/support/unix_connect.py	2009-11-05 06:06:23.000000000 -0500
4
@@ -161,6 +161,14 @@
5
     except os.error:
6
         pass
7
 
8
+    if not auth_data and host=='localhost':
9
+	# 127.0.0.1 counts as FamilyLocal, not FamilyInternet
10
+	# See Xtransutil.c:ConvertAddress.
11
+	# There might be more ways to spell 127.0.0.1 but
12
+	# 'localhost', yet this code fixes a the case of
13
+	# OpenSSH tunneling X.
14
+        return get_auth('unix:%d' % dno, 'unix', dno)
15
+
16
     return auth_name, auth_data
17
 
18
 get_auth = new_get_auth
view file @ 826154ccd0
... ... --- a/python-xlib-0.15rc1-get_best_auth.patch
... ... +++ /dev/null
... ... @@ -1,22 +0,0 @@
0
diff -Naur python-xlib-0.15rc1.orig/Xlib/xauth.py python-xlib-0.15rc1/Xlib/xauth.py
1
--- python-xlib-0.15rc1.orig/Xlib/xauth.py	2015-06-08 10:07:58.209180605 +0300
2
+++ python-xlib-0.15rc1/Xlib/xauth.py	2015-06-08 10:08:55.127177234 +0300
3
@@ -97,7 +97,7 @@
4
         return self.entries[i]
5
 
6
     def get_best_auth(self, family, address, dispno,
7
-                      types = ( "MIT-MAGIC-COOKIE-1", )):
8
+                      types = ( b"MIT-MAGIC-COOKIE-1", )):
9
 
10
         """Find an authentication entry matching FAMILY, ADDRESS and
11
         DISPNO.
12
@@ -110,7 +110,8 @@
13
         otherwise XNoAuthError is raised.
14
         """
15
 
16
-        num = str(dispno)
17
+        num = str(dispno).encode()
18
+        address = address.encode()
19
 
20
         matches = {}
21
 
view file @ 826154ccd0
... ... --- a/python-xlib-0.15rc1-python3.patch
... ... +++ /dev/null
... ... @@ -1,10332 +0,0 @@
0
diff -Naur python-xlib-0.15rc1.orig.orig/examples/profilex.py python-xlib-0.15rc1.orig/examples/profilex.py
1
--- python-xlib-0.15rc1.orig.orig/examples/profilex.py	2015-06-03 21:47:39.000000000 +0300
2
+++ python-xlib-0.15rc1.orig/examples/profilex.py	2015-06-03 21:47:43.000000000 +0300
3
@@ -18,9 +18,9 @@
4
     r = d.screen().root
5
     cm = d.screen().default_colormap
6
 
7
-    for i in xrange(0, 1000):
8
+    for i in range(0, 1000):
9
         if i % 50 == 0:
10
-            print 'Iteration', i
11
+            print('Iteration %i' % i)
12
 
13
         r.delete_property(Xatom.WM_NORMAL_HINTS)
14
         r.delete_property(Xatom.WM_NORMAL_HINTS)
15
@@ -39,4 +39,4 @@
16
     if len(sys.argv) == 2:
17
         main(sys.argv[1])
18
     else:
19
-        print sys.argv[0], "<filename to write profile output to>"
20
+        print(sys.argv[0] + " <filename to write profile output to>")
21
diff -Naur python-xlib-0.15rc1.orig.orig/examples/shapewin.py python-xlib-0.15rc1.orig/examples/shapewin.py
22
--- python-xlib-0.15rc1.orig.orig/examples/shapewin.py	2015-06-03 21:47:39.000000000 +0300
23
+++ python-xlib-0.15rc1.orig/examples/shapewin.py	2015-06-03 21:47:43.000000000 +0300
24
@@ -41,7 +41,7 @@
25
 
26
         # print version
27
         r = self.d.shape_query_version()
28
-        print 'SHAPE version %d.%d' % (r.major_version, r.minor_version)
29
+        print('SHAPE version %d.%d' % (r.major_version, r.minor_version))
30
 
31
 
32
         # Find which screen to open the window on
33
@@ -59,10 +59,10 @@
34
 
35
         bggc.change(foreground = self.screen.white_pixel)
36
 
37
-        bgpm.arc(bggc, -bgsize / 2, 0, bgsize, bgsize, 0, 360 * 64)
38
-        bgpm.arc(bggc, bgsize / 2, 0, bgsize, bgsize, 0, 360 * 64)
39
-        bgpm.arc(bggc, 0, -bgsize / 2, bgsize, bgsize, 0, 360 * 64)
40
-        bgpm.arc(bggc, 0, bgsize / 2, bgsize, bgsize, 0, 360 * 64)
41
+        bgpm.arc(bggc, -bgsize // 2, 0, bgsize, bgsize, 0, 360 * 64)
42
+        bgpm.arc(bggc, bgsize // 2, 0, bgsize, bgsize, 0, 360 * 64)
43
+        bgpm.arc(bggc, 0, -bgsize // 2, bgsize, bgsize, 0, 360 * 64)
44
+        bgpm.arc(bggc, 0, bgsize // 2, bgsize, bgsize, 0, 360 * 64)
45
 
46
         # Actual window
47
         self.window = self.screen.root.create_window(
48
@@ -112,10 +112,10 @@
49
         self.sub_pm.fill_rectangle(gc, 0, 0, self.sub_size, self.sub_size)
50
         gc.change(foreground = 1)
51
         self.sub_pm.fill_poly(gc, X.Convex, X.CoordModeOrigin,
52
-                              [(self.sub_size / 2, 0),
53
-                               (self.sub_size, self.sub_size / 2),
54
-                               (self.sub_size / 2, self.sub_size),
55
-                               (0, self.sub_size / 2)])
56
+                              [(self.sub_size // 2, 0),
57
+                               (self.sub_size, self.sub_size // 2),
58
+                               (self.sub_size // 2, self.sub_size),
59
+                               (0, self.sub_size // 2)])
60
         gc.free()
61
 
62
         # Set initial mask
63
@@ -151,19 +151,19 @@
64
                 if e.detail == 1:
65
                     self.window.shape_mask(shape.ShapeUnion,
66
                                            shape.ShapeBounding,
67
-                                           e.event_x - self.add_size / 2,
68
-                                           e.event_y - self.add_size / 2,
69
+                                           e.event_x - self.add_size // 2,
70
+                                           e.event_y - self.add_size // 2,
71
                                            self.add_pm)
72
                 elif e.detail == 3:
73
                     self.window.shape_mask(shape.ShapeSubtract,
74
                                            shape.ShapeBounding,
75
-                                           e.event_x - self.sub_size / 2,
76
-                                           e.event_y - self.sub_size / 2,
77
+                                           e.event_x - self.sub_size // 2,
78
+                                           e.event_y - self.sub_size // 2,
79
                                            self.sub_pm)
80
 
81
             # Shape has changed
82
             elif e.type == self.d.extension_event.ShapeNotify:
83
-                print 'Shape change'
84
+                print('Shape change')
85
 
86
             # Somebody wants to tell us something
87
             elif e.type == X.ClientMessage:
88
diff -Naur python-xlib-0.15rc1.orig.orig/examples/threadtest.py python-xlib-0.15rc1.orig/examples/threadtest.py
89
--- python-xlib-0.15rc1.orig.orig/examples/threadtest.py	2015-06-03 21:47:39.000000000 +0300
90
+++ python-xlib-0.15rc1.orig/examples/threadtest.py	2015-06-03 21:47:43.000000000 +0300
91
@@ -7,7 +7,13 @@
92
 
93
 from Xlib import display, X, threaded
94
 import time
95
-import thread
96
+
97
+try:
98
+    # Python 3
99
+    import _thread as thread
100
+except ImportError:
101
+    # Python 2
102
+    import thread
103
 
104
 def redraw(win, gc):
105
     # win.clear_area()
106
@@ -16,7 +22,7 @@
107
 def blink(display, win, gc, cols):
108
     while 1:
109
         time.sleep(2)
110
-        print 'Changing color', cols[0]
111
+        print('Changing color %i' % cols[0])
112
         gc.change(foreground = cols[0])
113
         cols = (cols[1], cols[0])
114
         redraw(win, gc)
115
diff -Naur python-xlib-0.15rc1.orig.orig/test/test_events_be.py python-xlib-0.15rc1.orig/test/test_events_be.py
116
--- python-xlib-0.15rc1.orig.orig/test/test_events_be.py	2015-06-03 21:47:39.000000000 +0300
117
+++ python-xlib-0.15rc1.orig/test/test_events_be.py	2015-06-03 21:47:43.000000000 +0300
118
@@ -3,7 +3,6 @@
119
 import sys, os
120
 sys.path.insert(1, os.path.join(sys.path[0], '..'))
121
 
122
-import string
123
 import unittest
124
 from Xlib.protocol import request, rq, event
125
 import Xlib.protocol.event
126
@@ -13,7 +12,7 @@
127
 
128
 class CmpArray:
129
     def __init__(self, *args, **kws):
130
-        self.array = apply(array.array, args, kws)
131
+        self.array = array.array(*args, **kws)
132
 
133
     def __len__(self):
134
         return len(self.array)
135
@@ -24,13 +23,16 @@
136
     def __getattr__(self, attr):
137
         return getattr(self.array, attr)
138
 
139
-    def __cmp__(self, other):
140
-        return cmp(self.array.tolist(), other)
141
+    def __eq__(self, other):
142
+        return self.array.tolist() == other
143
+
144
+    def __ne__(self, other):
145
+        return self.array.tolist() != other
146
 
147
 rq.array = CmpArray
148
 
149
 def tohex(bin):
150
-    bin = string.join(map(lambda c: '\\x%02x' % ord(c), bin), '')
151
+    bin = ''.join(map(lambda c: '\\x%02x' % c, bin))
152
 
153
     bins = []
154
     for i in range(0, len(bin), 16):
155
@@ -43,7 +45,7 @@
156
         except IndexError:
157
             bins2.append("'%s'" % bins[i])
158
 
159
-    return string.join(bins2, ' \\\n            ')
160
+    return ' \\\n            '.join(bins2)
161
 
162
 class DummyDisplay:
163
     def get_resource_class(self, x):
164
@@ -66,14 +68,14 @@
165
             'type': 154,
166
             'data': [160, 192, 133, 223, 245, 128, 133, 188, 208, 142, 202, 142, 218, 238, 145, 150, 211, 150, 165, 230, 149, 162, 139, 159, 135, 255, 246, 202, 232, 185, 164],
167
             }
168
-        self.evt_bin_0 = '\x9a\xa0\xc0\x85' '\xdf\xf5\x80\x85' \
169
-            '\xbc\xd0\x8e\xca' '\x8e\xda\xee\x91' \
170
-            '\x96\xd3\x96\xa5' '\xe6\x95\xa2\x8b' \
171
-            '\x9f\x87\xff\xf6' '\xca\xe8\xb9\xa4'
172
+        self.evt_bin_0 = b'\x9a\xa0\xc0\x85' b'\xdf\xf5\x80\x85' \
173
+            b'\xbc\xd0\x8e\xca' b'\x8e\xda\xee\x91' \
174
+            b'\x96\xd3\x96\xa5' b'\xe6\x95\xa2\x8b' \
175
+            b'\x9f\x87\xff\xf6' b'\xca\xe8\xb9\xa4'
176
 
177
 
178
     def testPack0(self):
179
-        bin = apply(event.KeymapNotify._fields.to_binary, (), self.evt_args_0)
180
+        bin = event.KeymapNotify._fields.to_binary(*(), **self.evt_args_0)
181
         try:
182
             assert bin == self.evt_bin_0
183
         except AssertionError:
184
@@ -103,14 +105,14 @@
185
             'width': 26369,
186
             'count': 60118,
187
             }
188
-        self.evt_bin_0 = '\xfe\x00\xdb\xcc' '\x52\x5b\x35\x64' \
189
-            '\x42\x4e\x4d\x28' '\x67\x01\x56\xc6' \
190
-            '\xea\xd6\x00\x00' '\x00\x00\x00\x00' \
191
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
192
+        self.evt_bin_0 = b'\xfe\x00\xdb\xcc' b'\x52\x5b\x35\x64' \
193
+            b'\x42\x4e\x4d\x28' b'\x67\x01\x56\xc6' \
194
+            b'\xea\xd6\x00\x00' b'\x00\x00\x00\x00' \
195
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
196
 
197
 
198
     def testPack0(self):
199
-        bin = apply(event.Expose._fields.to_binary, (), self.evt_args_0)
200
+        bin = event.Expose._fields.to_binary(*(), **self.evt_args_0)
201
         try:
202
             assert bin == self.evt_bin_0
203
         except AssertionError:
204
@@ -142,14 +144,14 @@
205
             'width': 58556,
206
             'minor_event': 22632,
207
             }
208
-        self.evt_bin_0 = '\xf2\x00\x18\xec' '\x30\xe6\x7b\x80' \
209
-            '\xe0\xf9\xa3\x22' '\xe4\xbc\x01\x60' \
210
-            '\x58\x68\xf7\x59' '\xd8\x00\x00\x00' \
211
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
212
+        self.evt_bin_0 = b'\xf2\x00\x18\xec' b'\x30\xe6\x7b\x80' \
213
+            b'\xe0\xf9\xa3\x22' b'\xe4\xbc\x01\x60' \
214
+            b'\x58\x68\xf7\x59' b'\xd8\x00\x00\x00' \
215
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
216
 
217
 
218
     def testPack0(self):
219
-        bin = apply(event.GraphicsExpose._fields.to_binary, (), self.evt_args_0)
220
+        bin = event.GraphicsExpose._fields.to_binary(*(), **self.evt_args_0)
221
         try:
222
             assert bin == self.evt_bin_0
223
         except AssertionError:
224
@@ -176,14 +178,14 @@
225
             'window': 1319843810,
226
             'minor_event': 45687,
227
             }
228
-        self.evt_bin_0 = '\xbb\x00\xb4\x5b' '\x4e\xab\x37\xe2' \
229
-            '\xb2\x77\xf2\x00' '\x00\x00\x00\x00' \
230
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
231
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
232
+        self.evt_bin_0 = b'\xbb\x00\xb4\x5b' b'\x4e\xab\x37\xe2' \
233
+            b'\xb2\x77\xf2\x00' b'\x00\x00\x00\x00' \
234
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
235
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
236
 
237
 
238
     def testPack0(self):
239
-        bin = apply(event.NoExpose._fields.to_binary, (), self.evt_args_0)
240
+        bin = event.NoExpose._fields.to_binary(*(), **self.evt_args_0)
241
         try:
242
             assert bin == self.evt_bin_0
243
         except AssertionError:
244
@@ -209,14 +211,14 @@
245
             'type': 242,
246
             'window': 1543431298,
247
             }
248
-        self.evt_bin_0 = '\xf2\x00\xce\x45' '\x5b\xfe\xe4\x82' \
249
-            '\xee\x00\x00\x00' '\x00\x00\x00\x00' \
250
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
251
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
252
+        self.evt_bin_0 = b'\xf2\x00\xce\x45' b'\x5b\xfe\xe4\x82' \
253
+            b'\xee\x00\x00\x00' b'\x00\x00\x00\x00' \
254
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
255
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
256
 
257
 
258
     def testPack0(self):
259
-        bin = apply(event.VisibilityNotify._fields.to_binary, (), self.evt_args_0)
260
+        bin = event.VisibilityNotify._fields.to_binary(*(), **self.evt_args_0)
261
         try:
262
             assert bin == self.evt_bin_0
263
         except AssertionError:
264
@@ -248,14 +250,14 @@
265
             'window': 8505372,
266
             'width': 8871,
267
             }
268
-        self.evt_bin_0 = '\xff\x00\x20\x3d' '\x27\x00\x3a\x54' \
269
-            '\x00\x81\xc8\x1c' '\x86\x1c\xa2\x9c' \
270
-            '\x22\xa7\x3c\x92' '\xd0\xa6\x01\x00' \
271
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
272
+        self.evt_bin_0 = b'\xff\x00\x20\x3d' b'\x27\x00\x3a\x54' \
273
+            b'\x00\x81\xc8\x1c' b'\x86\x1c\xa2\x9c' \
274
+            b'\x22\xa7\x3c\x92' b'\xd0\xa6\x01\x00' \
275
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
276
 
277
 
278
     def testPack0(self):
279
-        bin = apply(event.CreateNotify._fields.to_binary, (), self.evt_args_0)
280
+        bin = event.CreateNotify._fields.to_binary(*(), **self.evt_args_0)
281
         try:
282
             assert bin == self.evt_bin_0
283
         except AssertionError:
284
@@ -281,14 +283,14 @@
285
             'type': 223,
286
             'window': 1716558237,
287
             }
288
-        self.evt_bin_0 = '\xdf\x00\xbf\xf1' '\x18\x56\x02\x91' \
289
-            '\x66\x50\x99\x9d' '\x00\x00\x00\x00' \
290
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
291
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
292
+        self.evt_bin_0 = b'\xdf\x00\xbf\xf1' b'\x18\x56\x02\x91' \
293
+            b'\x66\x50\x99\x9d' b'\x00\x00\x00\x00' \
294
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
295
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
296
 
297
 
298
     def testPack0(self):
299
-        bin = apply(event.DestroyNotify._fields.to_binary, (), self.evt_args_0)
300
+        bin = event.DestroyNotify._fields.to_binary(*(), **self.evt_args_0)
301
         try:
302
             assert bin == self.evt_bin_0
303
         except AssertionError:
304
@@ -315,14 +317,14 @@
305
             'type': 217,
306
             'window': 1455493798,
307
             }
308
-        self.evt_bin_0 = '\xd9\x00\x11\x3c' '\x42\xe1\xef\x20' \
309
-            '\x56\xc1\x12\xa6' '\x00\x00\x00\x00' \
310
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
311
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
312
+        self.evt_bin_0 = b'\xd9\x00\x11\x3c' b'\x42\xe1\xef\x20' \
313
+            b'\x56\xc1\x12\xa6' b'\x00\x00\x00\x00' \
314
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
315
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
316
 
317
 
318
     def testPack0(self):
319
-        bin = apply(event.UnmapNotify._fields.to_binary, (), self.evt_args_0)
320
+        bin = event.UnmapNotify._fields.to_binary(*(), **self.evt_args_0)
321
         try:
322
             assert bin == self.evt_bin_0
323
         except AssertionError:
324
@@ -349,14 +351,14 @@
325
             'window': 1882369959,
326
             'override': 0,
327
             }
328
-        self.evt_bin_0 = '\xe4\x00\xfe\x48' '\x13\x96\x31\xdc' \
329
-            '\x70\x32\xaf\xa7' '\x00\x00\x00\x00' \
330
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
331
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
332
+        self.evt_bin_0 = b'\xe4\x00\xfe\x48' b'\x13\x96\x31\xdc' \
333
+            b'\x70\x32\xaf\xa7' b'\x00\x00\x00\x00' \
334
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
335
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
336
 
337
 
338
     def testPack0(self):
339
-        bin = apply(event.MapNotify._fields.to_binary, (), self.evt_args_0)
340
+        bin = event.MapNotify._fields.to_binary(*(), **self.evt_args_0)
341
         try:
342
             assert bin == self.evt_bin_0
343
         except AssertionError:
344
@@ -382,14 +384,14 @@
345
             'type': 171,
346
             'window': 488763730,
347
             }
348
-        self.evt_bin_0 = '\xab\x00\xc9\x60' '\x63\x32\x36\x90' \
349
-            '\x1d\x21\xf1\x52' '\x00\x00\x00\x00' \
350
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
351
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
352
+        self.evt_bin_0 = b'\xab\x00\xc9\x60' b'\x63\x32\x36\x90' \
353
+            b'\x1d\x21\xf1\x52' b'\x00\x00\x00\x00' \
354
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
355
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
356
 
357
 
358
     def testPack0(self):
359
-        bin = apply(event.MapRequest._fields.to_binary, (), self.evt_args_0)
360
+        bin = event.MapRequest._fields.to_binary(*(), **self.evt_args_0)
361
         try:
362
             assert bin == self.evt_bin_0
363
         except AssertionError:
364
@@ -419,14 +421,14 @@
365
             'parent': 912114770,
366
             'window': 1142506827,
367
             }
368
-        self.evt_bin_0 = '\xe5\x00\x24\x28' '\x77\x39\xbd\xd5' \
369
-            '\x44\x19\x45\x4b' '\x36\x5d\xc4\x52' \
370
-            '\x90\x55\xd2\xb3' '\x01\x00\x00\x00' \
371
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
372
+        self.evt_bin_0 = b'\xe5\x00\x24\x28' b'\x77\x39\xbd\xd5' \
373
+            b'\x44\x19\x45\x4b' b'\x36\x5d\xc4\x52' \
374
+            b'\x90\x55\xd2\xb3' b'\x01\x00\x00\x00' \
375
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
376
 
377
 
378
     def testPack0(self):
379
-        bin = apply(event.ReparentNotify._fields.to_binary, (), self.evt_args_0)
380
+        bin = event.ReparentNotify._fields.to_binary(*(), **self.evt_args_0)
381
         try:
382
             assert bin == self.evt_bin_0
383
         except AssertionError:
384
@@ -459,14 +461,14 @@
385
             'window': 2046157981,
386
             'width': 8604,
387
             }
388
-        self.evt_bin_0 = '\xbf\x00\xf3\x9c' '\x51\xdd\x44\x66' \
389
-            '\x79\xf5\xe4\x9d' '\x41\x8b\x95\xa2' \
390
-            '\xce\x1d\xc4\x84' '\x21\x9c\x3f\x73' \
391
-            '\x1c\x4c\x01\x00' '\x00\x00\x00\x00'
392
+        self.evt_bin_0 = b'\xbf\x00\xf3\x9c' b'\x51\xdd\x44\x66' \
393
+            b'\x79\xf5\xe4\x9d' b'\x41\x8b\x95\xa2' \
394
+            b'\xce\x1d\xc4\x84' b'\x21\x9c\x3f\x73' \
395
+            b'\x1c\x4c\x01\x00' b'\x00\x00\x00\x00'
396
 
397
 
398
     def testPack0(self):
399
-        bin = apply(event.ConfigureNotify._fields.to_binary, (), self.evt_args_0)
400
+        bin = event.ConfigureNotify._fields.to_binary(*(), **self.evt_args_0)
401
         try:
402
             assert bin == self.evt_bin_0
403
         except AssertionError:
404
@@ -500,14 +502,14 @@
405
             'stack_mode': 199,
406
             'parent': 176713389,
407
             }
408
-        self.evt_bin_0 = '\x9c\xc7\x7a\x91' '\x0a\x88\x6e\xad' \
409
-            '\x49\x60\x48\x53' '\x44\xd3\x8b\x96' \
410
-            '\xb8\xf1\xbb\x01' '\xc9\xa4\xb7\xf6' \
411
-            '\xd5\xfb\x4b\x91' '\x00\x00\x00\x00'
412
+        self.evt_bin_0 = b'\x9c\xc7\x7a\x91' b'\x0a\x88\x6e\xad' \
413
+            b'\x49\x60\x48\x53' b'\x44\xd3\x8b\x96' \
414
+            b'\xb8\xf1\xbb\x01' b'\xc9\xa4\xb7\xf6' \
415
+            b'\xd5\xfb\x4b\x91' b'\x00\x00\x00\x00'
416
 
417
 
418
     def testPack0(self):
419
-        bin = apply(event.ConfigureRequest._fields.to_binary, (), self.evt_args_0)
420
+        bin = event.ConfigureRequest._fields.to_binary(*(), **self.evt_args_0)
421
         try:
422
             assert bin == self.evt_bin_0
423
         except AssertionError:
424
@@ -535,14 +537,14 @@
425
             'x': -21924,
426
             'y': -4866,
427
             }
428
-        self.evt_bin_0 = '\xc0\x00\xa9\x70' '\x26\x3d\x12\xa5' \
429
-            '\x03\x14\xd8\x1a' '\xaa\x5c\xec\xfe' \
430
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
431
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
432
+        self.evt_bin_0 = b'\xc0\x00\xa9\x70' b'\x26\x3d\x12\xa5' \
433
+            b'\x03\x14\xd8\x1a' b'\xaa\x5c\xec\xfe' \
434
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
435
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
436
 
437
 
438
     def testPack0(self):
439
-        bin = apply(event.GravityNotify._fields.to_binary, (), self.evt_args_0)
440
+        bin = event.GravityNotify._fields.to_binary(*(), **self.evt_args_0)
441
         try:
442
             assert bin == self.evt_bin_0
443
         except AssertionError:
444
@@ -569,14 +571,14 @@
445
             'window': 1698104652,
446
             'width': 41494,
447
             }
448
-        self.evt_bin_0 = '\x95\x00\x53\x64' '\x65\x37\x05\x4c' \
449
-            '\xa2\x16\xe9\x68' '\x00\x00\x00\x00' \
450
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
451
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
452
+        self.evt_bin_0 = b'\x95\x00\x53\x64' b'\x65\x37\x05\x4c' \
453
+            b'\xa2\x16\xe9\x68' b'\x00\x00\x00\x00' \
454
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
455
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
456
 
457
 
458
     def testPack0(self):
459
-        bin = apply(event.ResizeRequest._fields.to_binary, (), self.evt_args_0)
460
+        bin = event.ResizeRequest._fields.to_binary(*(), **self.evt_args_0)
461
         try:
462
             assert bin == self.evt_bin_0
463
         except AssertionError:
464
@@ -604,14 +606,14 @@
465
             'state': 181,
466
             'window': 334365400,
467
             }
468
-        self.evt_bin_0 = '\xbc\x00\x73\xe6' '\x13\xee\x02\xd8' \
469
-            '\x2d\x74\x24\x38' '\x6a\xc2\x4b\x25' \
470
-            '\xb5\x00\x00\x00' '\x00\x00\x00\x00' \
471
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
472
+        self.evt_bin_0 = b'\xbc\x00\x73\xe6' b'\x13\xee\x02\xd8' \
473
+            b'\x2d\x74\x24\x38' b'\x6a\xc2\x4b\x25' \
474
+            b'\xb5\x00\x00\x00' b'\x00\x00\x00\x00' \
475
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
476
 
477
 
478
     def testPack0(self):
479
-        bin = apply(event.PropertyNotify._fields.to_binary, (), self.evt_args_0)
480
+        bin = event.PropertyNotify._fields.to_binary(*(), **self.evt_args_0)
481
         try:
482
             assert bin == self.evt_bin_0
483
         except AssertionError:
484
@@ -638,14 +640,14 @@
485
             'type': 170,
486
             'window': 355039782,
487
             }
488
-        self.evt_bin_0 = '\xaa\x00\x35\x7b' '\x22\x74\xca\x43' \
489
-            '\x15\x29\x7a\x26' '\x52\x94\x54\x73' \
490
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
491
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
492
+        self.evt_bin_0 = b'\xaa\x00\x35\x7b' b'\x22\x74\xca\x43' \
493
+            b'\x15\x29\x7a\x26' b'\x52\x94\x54\x73' \
494
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
495
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
496
 
497
 
498
     def testPack0(self):
499
-        bin = apply(event.SelectionClear._fields.to_binary, (), self.evt_args_0)
500
+        bin = event.SelectionClear._fields.to_binary(*(), **self.evt_args_0)
501
         try:
502
             assert bin == self.evt_bin_0
503
         except AssertionError:
504
@@ -675,14 +677,14 @@
505
             'selection': 1972323175,
506
             'requestor': 178195168,
507
             }
508
-        self.evt_bin_0 = '\xa2\x00\x33\xc6' '\x44\xd2\x57\x9a' \
509
-            '\x7b\xba\xc5\x57' '\x0a\x9f\x0a\xe0' \
510
-            '\x75\x8f\x43\x67' '\x4e\x3b\xb0\x83' \
511
-            '\x17\xac\x30\xe9' '\x00\x00\x00\x00'
512
+        self.evt_bin_0 = b'\xa2\x00\x33\xc6' b'\x44\xd2\x57\x9a' \
513
+            b'\x7b\xba\xc5\x57' b'\x0a\x9f\x0a\xe0' \
514
+            b'\x75\x8f\x43\x67' b'\x4e\x3b\xb0\x83' \
515
+            b'\x17\xac\x30\xe9' b'\x00\x00\x00\x00'
516
 
517
 
518
     def testPack0(self):
519
-        bin = apply(event.SelectionRequest._fields.to_binary, (), self.evt_args_0)
520
+        bin = event.SelectionRequest._fields.to_binary(*(), **self.evt_args_0)
521
         try:
522
             assert bin == self.evt_bin_0
523
         except AssertionError:
524
@@ -711,14 +713,14 @@
525
             'selection': 781895626,
526
             'requestor': 1242076588,
527
             }
528
-        self.evt_bin_0 = '\xc7\x00\x9b\x38' '\x34\x95\x2f\x5e' \
529
-            '\x4a\x08\x95\xac' '\x2e\x9a\xc7\xca' \
530
-            '\x7f\x0b\x8a\x2d' '\x12\x05\xd7\x93' \
531
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
532
+        self.evt_bin_0 = b'\xc7\x00\x9b\x38' b'\x34\x95\x2f\x5e' \
533
+            b'\x4a\x08\x95\xac' b'\x2e\x9a\xc7\xca' \
534
+            b'\x7f\x0b\x8a\x2d' b'\x12\x05\xd7\x93' \
535
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
536
 
537
 
538
     def testPack0(self):
539
-        bin = apply(event.SelectionNotify._fields.to_binary, (), self.evt_args_0)
540
+        bin = event.SelectionNotify._fields.to_binary(*(), **self.evt_args_0)
541
         try:
542
             assert bin == self.evt_bin_0
543
         except AssertionError:
544
@@ -746,14 +748,14 @@
545
             'window': 1591667531,
546
             'new': 1,
547
             }
548
-        self.evt_bin_0 = '\xe9\x00\xf5\xb6' '\x5e\xde\xeb\x4b' \
549
-            '\x11\xed\xd7\x06' '\x01\xd1\x00\x00' \
550
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
551
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
552
+        self.evt_bin_0 = b'\xe9\x00\xf5\xb6' b'\x5e\xde\xeb\x4b' \
553
+            b'\x11\xed\xd7\x06' b'\x01\xd1\x00\x00' \
554
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
555
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
556
 
557
 
558
     def testPack0(self):
559
-        bin = apply(event.ColormapNotify._fields.to_binary, (), self.evt_args_0)
560
+        bin = event.ColormapNotify._fields.to_binary(*(), **self.evt_args_0)
561
         try:
562
             assert bin == self.evt_bin_0
563
         except AssertionError:
564
@@ -780,10 +782,10 @@
565
             'client_type': 1340394836,
566
             'window': 1256861040,
567
             }
568
-        self.evt_bin_0 = '\xf5\x08\xbe\x48' '\x4a\xea\x2d\x70' \
569
-            '\x4f\xe4\xcd\x54' '\x30\x31\x32\x33' \
570
-            '\x34\x35\x36\x37' '\x38\x39\x30\x31' \
571
-            '\x32\x33\x34\x35' '\x36\x37\x38\x39'
572
+        self.evt_bin_0 = b'\xf5\x08\xbe\x48' b'\x4a\xea\x2d\x70' \
573
+            b'\x4f\xe4\xcd\x54' b'\x30\x31\x32\x33' \
574
+            b'\x34\x35\x36\x37' b'\x38\x39\x30\x31' \
575
+            b'\x32\x33\x34\x35' b'\x36\x37\x38\x39'
576
 
577
         self.evt_args_1 = {
578
             'sequence_number': 62804,
579
@@ -792,10 +794,10 @@
580
             'client_type': 214585025,
581
             'window': 151327338,
582
             }
583
-        self.evt_bin_1 = '\xfa\x10\xf5\x54' '\x09\x05\x12\x6a' \
584
-            '\x0c\xca\x4e\xc1' '\x00\x01\x00\x02' \
585
-            '\x00\x03\x00\x04' '\x00\x05\x00\x06' \
586
-            '\x00\x07\x00\x08' '\x00\x09\x00\x0a'
587
+        self.evt_bin_1 = b'\xfa\x10\xf5\x54' b'\x09\x05\x12\x6a' \
588
+            b'\x0c\xca\x4e\xc1' b'\x00\x01\x00\x02' \
589
+            b'\x00\x03\x00\x04' b'\x00\x05\x00\x06' \
590
+            b'\x00\x07\x00\x08' b'\x00\x09\x00\x0a'
591
 
592
         self.evt_args_2 = {
593
             'sequence_number': 3122,
594
@@ -804,14 +806,14 @@
595
             'client_type': 698151018,
596
             'window': 725159371,
597
             }
598
-        self.evt_bin_2 = '\xf3\x20\x0c\x32' '\x2b\x39\x0d\xcb' \
599
-            '\x29\x9c\xf0\x6a' '\x00\x00\x00\x01' \
600
-            '\x00\x00\x00\x02' '\x00\x00\x00\x03' \
601
-            '\x00\x00\x00\x04' '\x00\x00\x00\x05'
602
+        self.evt_bin_2 = b'\xf3\x20\x0c\x32' b'\x2b\x39\x0d\xcb' \
603
+            b'\x29\x9c\xf0\x6a' b'\x00\x00\x00\x01' \
604
+            b'\x00\x00\x00\x02' b'\x00\x00\x00\x03' \
605
+            b'\x00\x00\x00\x04' b'\x00\x00\x00\x05'
606
 
607
 
608
     def testPack0(self):
609
-        bin = apply(event.ClientMessage._fields.to_binary, (), self.evt_args_0)
610
+        bin = event.ClientMessage._fields.to_binary(*(), **self.evt_args_0)
611
         try:
612
             assert bin == self.evt_bin_0
613
         except AssertionError:
614
@@ -829,7 +831,7 @@
615
             raise AssertionError(args)
616
 
617
     def testPack1(self):
618
-        bin = apply(event.ClientMessage._fields.to_binary, (), self.evt_args_1)
619
+        bin = event.ClientMessage._fields.to_binary(*(), **self.evt_args_1)
620
         try:
621
             assert bin == self.evt_bin_1
622
         except AssertionError:
623
@@ -847,7 +849,7 @@
624
             raise AssertionError(args)
625
 
626
     def testPack2(self):
627
-        bin = apply(event.ClientMessage._fields.to_binary, (), self.evt_args_2)
628
+        bin = event.ClientMessage._fields.to_binary(*(), **self.evt_args_2)
629
         try:
630
             assert bin == self.evt_bin_2
631
         except AssertionError:
632
@@ -874,14 +876,14 @@
633
             'type': 252,
634
             'first_keycode': 218,
635
             }
636
-        self.evt_bin_0 = '\xfc\x00\xd1\x25' '\x8d\xda\x97\x00' \
637
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
638
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
639
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
640
+        self.evt_bin_0 = b'\xfc\x00\xd1\x25' b'\x8d\xda\x97\x00' \
641
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
642
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
643
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
644
 
645
 
646
     def testPack0(self):
647
-        bin = apply(event.MappingNotify._fields.to_binary, (), self.evt_args_0)
648
+        bin = event.MappingNotify._fields.to_binary(*(), **self.evt_args_0)
649
         try:
650
             assert bin == self.evt_bin_0
651
         except AssertionError:
652
diff -Naur python-xlib-0.15rc1.orig.orig/test/test_events_le.py python-xlib-0.15rc1.orig/test/test_events_le.py
653
--- python-xlib-0.15rc1.orig.orig/test/test_events_le.py	2015-06-03 21:47:39.000000000 +0300
654
+++ python-xlib-0.15rc1.orig/test/test_events_le.py	2015-06-03 21:47:43.000000000 +0300
655
@@ -3,7 +3,6 @@
656
 import sys, os
657
 sys.path.insert(1, os.path.join(sys.path[0], '..'))
658
 
659
-import string
660
 import unittest
661
 from Xlib.protocol import request, rq, event
662
 import Xlib.protocol.event
663
@@ -13,7 +12,7 @@
664
 
665
 class CmpArray:
666
     def __init__(self, *args, **kws):
667
-        self.array = apply(array.array, args, kws)
668
+        self.array = array.array(*args, **kws)
669
 
670
     def __len__(self):
671
         return len(self.array)
672
@@ -24,13 +23,16 @@
673
     def __getattr__(self, attr):
674
         return getattr(self.array, attr)
675
 
676
-    def __cmp__(self, other):
677
-        return cmp(self.array.tolist(), other)
678
+    def __eq__(self, other):
679
+        return self.array.tolist() == other
680
+
681
+    def __ne__(self, other):
682
+        return self.array.tolist() != other
683
 
684
 rq.array = CmpArray
685
 
686
 def tohex(bin):
687
-    bin = string.join(map(lambda c: '\\x%02x' % ord(c), bin), '')
688
+    bin = ''.join(map(lambda c: '\\x%02x' % c, bin))
689
 
690
     bins = []
691
     for i in range(0, len(bin), 16):
692
@@ -43,7 +45,7 @@
693
         except IndexError:
694
             bins2.append("'%s'" % bins[i])
695
 
696
-    return string.join(bins2, ' \\\n            ')
697
+    return ' \\\n            '.join(bins2)
698
 
699
 class DummyDisplay:
700
     def get_resource_class(self, x):
701
@@ -66,14 +68,14 @@
702
             'type': 173,
703
             'data': [130, 181, 177, 244, 167, 144, 216, 185, 228, 220, 254, 130, 239, 213, 142, 240, 233, 248, 161, 238, 160, 205, 212, 205, 166, 156, 241, 169, 198, 147, 144],
704
             }
705
-        self.evt_bin_0 = '\xad\x82\xb5\xb1' '\xf4\xa7\x90\xd8' \
706
-            '\xb9\xe4\xdc\xfe' '\x82\xef\xd5\x8e' \
707
-            '\xf0\xe9\xf8\xa1' '\xee\xa0\xcd\xd4' \
708
-            '\xcd\xa6\x9c\xf1' '\xa9\xc6\x93\x90'
709
+        self.evt_bin_0 = b'\xad\x82\xb5\xb1' b'\xf4\xa7\x90\xd8' \
710
+            b'\xb9\xe4\xdc\xfe' b'\x82\xef\xd5\x8e' \
711
+            b'\xf0\xe9\xf8\xa1' b'\xee\xa0\xcd\xd4' \
712
+            b'\xcd\xa6\x9c\xf1' b'\xa9\xc6\x93\x90'
713
 
714
 
715
     def testPack0(self):
716
-        bin = apply(event.KeymapNotify._fields.to_binary, (), self.evt_args_0)
717
+        bin = event.KeymapNotify._fields.to_binary(*(), **self.evt_args_0)
718
         try:
719
             assert bin == self.evt_bin_0
720
         except AssertionError:
721
@@ -103,14 +105,14 @@
722
             'sequence_number': 45668,
723
             'height': 29709,
724
             }
725
-        self.evt_bin_0 = '\xc0\x00\x64\xb2' '\xb0\x95\xcc\x76' \
726
-            '\x24\x3d\xe2\x71' '\xc0\xde\x0d\x74' \
727
-            '\x57\x79\x00\x00' '\x00\x00\x00\x00' \
728
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
729
+        self.evt_bin_0 = b'\xc0\x00\x64\xb2' b'\xb0\x95\xcc\x76' \
730
+            b'\x24\x3d\xe2\x71' b'\xc0\xde\x0d\x74' \
731
+            b'\x57\x79\x00\x00' b'\x00\x00\x00\x00' \
732
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
733
 
734
 
735
     def testPack0(self):
736
-        bin = apply(event.Expose._fields.to_binary, (), self.evt_args_0)
737
+        bin = event.Expose._fields.to_binary(*(), **self.evt_args_0)
738
         try:
739
             assert bin == self.evt_bin_0
740
         except AssertionError:
741
@@ -142,14 +144,14 @@
742
             'sequence_number': 9516,
743
             'height': 10465,
744
             }
745
-        self.evt_bin_0 = '\x8a\x00\x2c\x25' '\xb1\xf4\xa7\x38' \
746
-            '\x79\xc3\x6c\x09' '\x92\x54\xe1\x28' \
747
-            '\x50\xad\x5a\x1b' '\xee\x00\x00\x00' \
748
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
749
+        self.evt_bin_0 = b'\x8a\x00\x2c\x25' b'\xb1\xf4\xa7\x38' \
750
+            b'\x79\xc3\x6c\x09' b'\x92\x54\xe1\x28' \
751
+            b'\x50\xad\x5a\x1b' b'\xee\x00\x00\x00' \
752
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
753
 
754
 
755
     def testPack0(self):
756
-        bin = apply(event.GraphicsExpose._fields.to_binary, (), self.evt_args_0)
757
+        bin = event.GraphicsExpose._fields.to_binary(*(), **self.evt_args_0)
758
         try:
759
             assert bin == self.evt_bin_0
760
         except AssertionError:
761
@@ -176,14 +178,14 @@
762
             'major_event': 149,
763
             'sequence_number': 51301,
764
             }
765
-        self.evt_bin_0 = '\xc6\x00\x65\xc8' '\x22\x92\xd6\x52' \
766
-            '\xa2\xbf\x95\x00' '\x00\x00\x00\x00' \
767
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
768
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
769
+        self.evt_bin_0 = b'\xc6\x00\x65\xc8' b'\x22\x92\xd6\x52' \
770
+            b'\xa2\xbf\x95\x00' b'\x00\x00\x00\x00' \
771
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
772
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
773
 
774
 
775
     def testPack0(self):
776
-        bin = apply(event.NoExpose._fields.to_binary, (), self.evt_args_0)
777
+        bin = event.NoExpose._fields.to_binary(*(), **self.evt_args_0)
778
         try:
779
             assert bin == self.evt_bin_0
780
         except AssertionError:
781
@@ -209,14 +211,14 @@
782
             'state': 239,
783
             'sequence_number': 38248,
784
             }
785
-        self.evt_bin_0 = '\xe9\x00\x68\x95' '\x72\xac\x93\x32' \
786
-            '\xef\x00\x00\x00' '\x00\x00\x00\x00' \
787
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
788
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
789
+        self.evt_bin_0 = b'\xe9\x00\x68\x95' b'\x72\xac\x93\x32' \
790
+            b'\xef\x00\x00\x00' b'\x00\x00\x00\x00' \
791
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
792
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
793
 
794
 
795
     def testPack0(self):
796
-        bin = apply(event.VisibilityNotify._fields.to_binary, (), self.evt_args_0)
797
+        bin = event.VisibilityNotify._fields.to_binary(*(), **self.evt_args_0)
798
         try:
799
             assert bin == self.evt_bin_0
800
         except AssertionError:
801
@@ -248,14 +250,14 @@
802
             'sequence_number': 14268,
803
             'height': 8803,
804
             }
805
-        self.evt_bin_0 = '\xe6\x00\xbc\x37' '\x55\x6b\xb4\x06' \
806
-            '\x58\x8e\x2b\x4f' '\x94\xca\x74\x85' \
807
-            '\xef\x5f\x63\x22' '\x2c\x80\x00\x00' \
808
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
809
+        self.evt_bin_0 = b'\xe6\x00\xbc\x37' b'\x55\x6b\xb4\x06' \
810
+            b'\x58\x8e\x2b\x4f' b'\x94\xca\x74\x85' \
811
+            b'\xef\x5f\x63\x22' b'\x2c\x80\x00\x00' \
812
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
813
 
814
 
815
     def testPack0(self):
816
-        bin = apply(event.CreateNotify._fields.to_binary, (), self.evt_args_0)
817
+        bin = event.CreateNotify._fields.to_binary(*(), **self.evt_args_0)
818
         try:
819
             assert bin == self.evt_bin_0
820
         except AssertionError:
821
@@ -281,14 +283,14 @@
822
             'event': 1596763581,
823
             'sequence_number': 37839,
824
             }
825
-        self.evt_bin_0 = '\xb7\x00\xcf\x93' '\xbd\xad\x2c\x5f' \
826
-            '\x39\xd4\x86\x52' '\x00\x00\x00\x00' \
827
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
828
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
829
+        self.evt_bin_0 = b'\xb7\x00\xcf\x93' b'\xbd\xad\x2c\x5f' \
830
+            b'\x39\xd4\x86\x52' b'\x00\x00\x00\x00' \
831
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
832
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
833
 
834
 
835
     def testPack0(self):
836
-        bin = apply(event.DestroyNotify._fields.to_binary, (), self.evt_args_0)
837
+        bin = event.DestroyNotify._fields.to_binary(*(), **self.evt_args_0)
838
         try:
839
             assert bin == self.evt_bin_0
840
         except AssertionError:
841
@@ -315,14 +317,14 @@
842
             'sequence_number': 55135,
843
             'from_configure': 0,
844
             }
845
-        self.evt_bin_0 = '\xc0\x00\x5f\xd7' '\x1a\x88\x73\x36' \
846
-            '\xf4\xb1\x87\x4b' '\x00\x00\x00\x00' \
847
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
848
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
849
+        self.evt_bin_0 = b'\xc0\x00\x5f\xd7' b'\x1a\x88\x73\x36' \
850
+            b'\xf4\xb1\x87\x4b' b'\x00\x00\x00\x00' \
851
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
852
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
853
 
854
 
855
     def testPack0(self):
856
-        bin = apply(event.UnmapNotify._fields.to_binary, (), self.evt_args_0)
857
+        bin = event.UnmapNotify._fields.to_binary(*(), **self.evt_args_0)
858
         try:
859
             assert bin == self.evt_bin_0
860
         except AssertionError:
861
@@ -349,14 +351,14 @@
862
             'event': 1566597012,
863
             'sequence_number': 8920,
864
             }
865
-        self.evt_bin_0 = '\xd8\x00\xd8\x22' '\x94\x5f\x60\x5d' \
866
-            '\xe8\xb1\x5a\x77' '\x00\x00\x00\x00' \
867
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
868
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
869
+        self.evt_bin_0 = b'\xd8\x00\xd8\x22' b'\x94\x5f\x60\x5d' \
870
+            b'\xe8\xb1\x5a\x77' b'\x00\x00\x00\x00' \
871
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
872
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
873
 
874
 
875
     def testPack0(self):
876
-        bin = apply(event.MapNotify._fields.to_binary, (), self.evt_args_0)
877
+        bin = event.MapNotify._fields.to_binary(*(), **self.evt_args_0)
878
         try:
879
             assert bin == self.evt_bin_0
880
         except AssertionError:
881
@@ -382,14 +384,14 @@
882
             'parent': 1188866605,
883
             'sequence_number': 6729,
884
             }
885
-        self.evt_bin_0 = '\xf2\x00\x49\x1a' '\x2d\xaa\xdc\x46' \
886
-            '\x4d\x6b\xba\x67' '\x00\x00\x00\x00' \
887
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
888
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
889
+        self.evt_bin_0 = b'\xf2\x00\x49\x1a' b'\x2d\xaa\xdc\x46' \
890
+            b'\x4d\x6b\xba\x67' b'\x00\x00\x00\x00' \
891
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
892
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
893
 
894
 
895
     def testPack0(self):
896
-        bin = apply(event.MapRequest._fields.to_binary, (), self.evt_args_0)
897
+        bin = event.MapRequest._fields.to_binary(*(), **self.evt_args_0)
898
         try:
899
             assert bin == self.evt_bin_0
900
         except AssertionError:
901
@@ -419,14 +421,14 @@
902
             'event': 1344092894,
903
             'sequence_number': 31034,
904
             }
905
-        self.evt_bin_0 = '\xb9\x00\x3a\x79' '\xde\x3a\x1d\x50' \
906
-            '\xff\xf9\xc4\x36' '\x1e\x3e\x65\x3e' \
907
-            '\xda\xd1\xfd\xd5' '\x00\x00\x00\x00' \
908
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
909
+        self.evt_bin_0 = b'\xb9\x00\x3a\x79' b'\xde\x3a\x1d\x50' \
910
+            b'\xff\xf9\xc4\x36' b'\x1e\x3e\x65\x3e' \
911
+            b'\xda\xd1\xfd\xd5' b'\x00\x00\x00\x00' \
912
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
913
 
914
 
915
     def testPack0(self):
916
-        bin = apply(event.ReparentNotify._fields.to_binary, (), self.evt_args_0)
917
+        bin = event.ReparentNotify._fields.to_binary(*(), **self.evt_args_0)
918
         try:
919
             assert bin == self.evt_bin_0
920
         except AssertionError:
921
@@ -459,14 +461,14 @@
922
             'event': 2102634753,
923
             'sequence_number': 21818,
924
             }
925
-        self.evt_bin_0 = '\xbf\x00\x3a\x55' '\x01\xa9\x53\x7d' \
926
-            '\xe9\xba\x4c\x65' '\x29\x26\x2f\x44' \
927
-            '\x5f\xa3\xb9\x80' '\x7f\x5e\x4d\xad' \
928
-            '\x55\xca\x01\x00' '\x00\x00\x00\x00'
929
+        self.evt_bin_0 = b'\xbf\x00\x3a\x55' b'\x01\xa9\x53\x7d' \
930
+            b'\xe9\xba\x4c\x65' b'\x29\x26\x2f\x44' \
931
+            b'\x5f\xa3\xb9\x80' b'\x7f\x5e\x4d\xad' \
932
+            b'\x55\xca\x01\x00' b'\x00\x00\x00\x00'
933
 
934
 
935
     def testPack0(self):
936
-        bin = apply(event.ConfigureNotify._fields.to_binary, (), self.evt_args_0)
937
+        bin = event.ConfigureNotify._fields.to_binary(*(), **self.evt_args_0)
938
         try:
939
             assert bin == self.evt_bin_0
940
         except AssertionError:
941
@@ -500,14 +502,14 @@
942
             'type': 140,
943
             'sequence_number': 48820,
944
             }
945
-        self.evt_bin_0 = '\x8c\x9b\xb4\xbe' '\xfc\xc8\x80\x58' \
946
-            '\xdd\x64\xbd\x20' '\xfe\xe2\xc1\x44' \
947
-            '\xfc\xd2\x05\xfc' '\x4a\xb6\x90\x6a' \
948
-            '\x53\xa1\x1b\xa3' '\x00\x00\x00\x00'
949
+        self.evt_bin_0 = b'\x8c\x9b\xb4\xbe' b'\xfc\xc8\x80\x58' \
950
+            b'\xdd\x64\xbd\x20' b'\xfe\xe2\xc1\x44' \
951
+            b'\xfc\xd2\x05\xfc' b'\x4a\xb6\x90\x6a' \
952
+            b'\x53\xa1\x1b\xa3' b'\x00\x00\x00\x00'
953
 
954
 
955
     def testPack0(self):
956
-        bin = apply(event.ConfigureRequest._fields.to_binary, (), self.evt_args_0)
957
+        bin = event.ConfigureRequest._fields.to_binary(*(), **self.evt_args_0)
958
         try:
959
             assert bin == self.evt_bin_0
960
         except AssertionError:
961
@@ -535,14 +537,14 @@
962
             'event': 860169186,
963
             'sequence_number': 48472,
964
             }
965
-        self.evt_bin_0 = '\xbf\x00\x58\xbd' '\xe2\x23\x45\x33' \
966
-            '\x38\x1b\xb0\x57' '\x7e\xd5\x27\x97' \
967
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
968
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
969
+        self.evt_bin_0 = b'\xbf\x00\x58\xbd' b'\xe2\x23\x45\x33' \
970
+            b'\x38\x1b\xb0\x57' b'\x7e\xd5\x27\x97' \
971
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
972
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
973
 
974
 
975
     def testPack0(self):
976
-        bin = apply(event.GravityNotify._fields.to_binary, (), self.evt_args_0)
977
+        bin = event.GravityNotify._fields.to_binary(*(), **self.evt_args_0)
978
         try:
979
             assert bin == self.evt_bin_0
980
         except AssertionError:
981
@@ -569,14 +571,14 @@
982
             'sequence_number': 9443,
983
             'height': 58942,
984
             }
985
-        self.evt_bin_0 = '\x8b\x00\xe3\x24' '\x73\xcf\x4f\x3b' \
986
-            '\x8a\x22\x3e\xe6' '\x00\x00\x00\x00' \
987
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
988
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
989
+        self.evt_bin_0 = b'\x8b\x00\xe3\x24' b'\x73\xcf\x4f\x3b' \
990
+            b'\x8a\x22\x3e\xe6' b'\x00\x00\x00\x00' \
991
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
992
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
993
 
994
 
995
     def testPack0(self):
996
-        bin = apply(event.ResizeRequest._fields.to_binary, (), self.evt_args_0)
997
+        bin = event.ResizeRequest._fields.to_binary(*(), **self.evt_args_0)
998
         try:
999
             assert bin == self.evt_bin_0
1000
         except AssertionError:
1001
@@ -604,14 +606,14 @@
1002
             'state': 241,
1003
             'sequence_number': 47586,
1004
             }
1005
-        self.evt_bin_0 = '\xcd\x00\xe2\xb9' '\xbe\x45\x1b\x69' \
1006
-            '\x60\x2c\xd0\x02' '\xca\x79\xd2\x37' \
1007
-            '\xf1\x00\x00\x00' '\x00\x00\x00\x00' \
1008
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
1009
+        self.evt_bin_0 = b'\xcd\x00\xe2\xb9' b'\xbe\x45\x1b\x69' \
1010
+            b'\x60\x2c\xd0\x02' b'\xca\x79\xd2\x37' \
1011
+            b'\xf1\x00\x00\x00' b'\x00\x00\x00\x00' \
1012
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
1013
 
1014
 
1015
     def testPack0(self):
1016
-        bin = apply(event.PropertyNotify._fields.to_binary, (), self.evt_args_0)
1017
+        bin = event.PropertyNotify._fields.to_binary(*(), **self.evt_args_0)
1018
         try:
1019
             assert bin == self.evt_bin_0
1020
         except AssertionError:
1021
@@ -638,14 +640,14 @@
1022
             'sequence_number': 26660,
1023
             'time': 1732839301,
1024
             }
1025
-        self.evt_bin_0 = '\xe8\x00\x24\x68' '\x85\x07\x49\x67' \
1026
-            '\x51\x65\x0b\x14' '\xff\x27\x49\x0f' \
1027
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
1028
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
1029
+        self.evt_bin_0 = b'\xe8\x00\x24\x68' b'\x85\x07\x49\x67' \
1030
+            b'\x51\x65\x0b\x14' b'\xff\x27\x49\x0f' \
1031
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
1032
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
1033
 
1034
 
1035
     def testPack0(self):
1036
-        bin = apply(event.SelectionClear._fields.to_binary, (), self.evt_args_0)
1037
+        bin = event.SelectionClear._fields.to_binary(*(), **self.evt_args_0)
1038
         try:
1039
             assert bin == self.evt_bin_0
1040
         except AssertionError:
1041
@@ -675,14 +677,14 @@
1042
             'type': 147,
1043
             'sequence_number': 20571,
1044
             }
1045
-        self.evt_bin_0 = '\x93\x00\x5b\x50' '\xe9\x35\xda\x54' \
1046
-            '\xf3\x3e\x97\x2d' '\x41\xc6\xca\x0f' \
1047
-            '\xc0\x1f\x8c\x5b' '\x07\xdb\x38\x24' \
1048
-            '\x26\x99\x6e\x44' '\x00\x00\x00\x00'
1049
+        self.evt_bin_0 = b'\x93\x00\x5b\x50' b'\xe9\x35\xda\x54' \
1050
+            b'\xf3\x3e\x97\x2d' b'\x41\xc6\xca\x0f' \
1051
+            b'\xc0\x1f\x8c\x5b' b'\x07\xdb\x38\x24' \
1052
+            b'\x26\x99\x6e\x44' b'\x00\x00\x00\x00'
1053
 
1054
 
1055
     def testPack0(self):
1056
-        bin = apply(event.SelectionRequest._fields.to_binary, (), self.evt_args_0)
1057
+        bin = event.SelectionRequest._fields.to_binary(*(), **self.evt_args_0)
1058
         try:
1059
             assert bin == self.evt_bin_0
1060
         except AssertionError:
1061
@@ -711,14 +713,14 @@
1062
             'type': 133,
1063
             'sequence_number': 30741,
1064
             }
1065
-        self.evt_bin_0 = '\x85\x00\x15\x78' '\xab\x44\xee\x3c' \
1066
-            '\xb1\x59\xe8\x39' '\x06\x6d\x83\x13' \
1067
-            '\xd1\xfe\xb7\x6f' '\xbe\x02\xcd\x6a' \
1068
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
1069
+        self.evt_bin_0 = b'\x85\x00\x15\x78' b'\xab\x44\xee\x3c' \
1070
+            b'\xb1\x59\xe8\x39' b'\x06\x6d\x83\x13' \
1071
+            b'\xd1\xfe\xb7\x6f' b'\xbe\x02\xcd\x6a' \
1072
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
1073
 
1074
 
1075
     def testPack0(self):
1076
-        bin = apply(event.SelectionNotify._fields.to_binary, (), self.evt_args_0)
1077
+        bin = event.SelectionNotify._fields.to_binary(*(), **self.evt_args_0)
1078
         try:
1079
             assert bin == self.evt_bin_0
1080
         except AssertionError:
1081
@@ -746,14 +748,14 @@
1082
             'state': 168,
1083
             'sequence_number': 8684,
1084
             }
1085
-        self.evt_bin_0 = '\xd3\x00\xec\x21' '\xbb\x4b\xb1\x50' \
1086
-            '\x9d\xab\x52\x27' '\x01\xa8\x00\x00' \
1087
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
1088
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
1089
+        self.evt_bin_0 = b'\xd3\x00\xec\x21' b'\xbb\x4b\xb1\x50' \
1090
+            b'\x9d\xab\x52\x27' b'\x01\xa8\x00\x00' \
1091
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
1092
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
1093
 
1094
 
1095
     def testPack0(self):
1096
-        bin = apply(event.ColormapNotify._fields.to_binary, (), self.evt_args_0)
1097
+        bin = event.ColormapNotify._fields.to_binary(*(), **self.evt_args_0)
1098
         try:
1099
             assert bin == self.evt_bin_0
1100
         except AssertionError:
1101
@@ -780,10 +782,10 @@
1102
             'data': (8, '01234567890123456789'),
1103
             'sequence_number': 14854,
1104
             }
1105
-        self.evt_bin_0 = '\xed\x08\x06\x3a' '\x82\xab\x90\x6b' \
1106
-            '\x49\x39\x23\x1b' '\x30\x31\x32\x33' \
1107
-            '\x34\x35\x36\x37' '\x38\x39\x30\x31' \
1108
-            '\x32\x33\x34\x35' '\x36\x37\x38\x39'
1109
+        self.evt_bin_0 = b'\xed\x08\x06\x3a' b'\x82\xab\x90\x6b' \
1110
+            b'\x49\x39\x23\x1b' b'\x30\x31\x32\x33' \
1111
+            b'\x34\x35\x36\x37' b'\x38\x39\x30\x31' \
1112
+            b'\x32\x33\x34\x35' b'\x36\x37\x38\x39'
1113
 
1114
         self.evt_args_1 = {
1115
             'type': 160,
1116
@@ -792,10 +794,10 @@
1117
             'data': (16, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),
1118
             'sequence_number': 28171,
1119
             }
1120
-        self.evt_bin_1 = '\xa0\x10\x0b\x6e' '\x3e\xb2\x8e\x38' \
1121
-            '\xac\x66\xa7\x0c' '\x01\x00\x02\x00' \
1122
-            '\x03\x00\x04\x00' '\x05\x00\x06\x00' \
1123
-            '\x07\x00\x08\x00' '\x09\x00\x0a\x00'
1124
+        self.evt_bin_1 = b'\xa0\x10\x0b\x6e' b'\x3e\xb2\x8e\x38' \
1125
+            b'\xac\x66\xa7\x0c' b'\x01\x00\x02\x00' \
1126
+            b'\x03\x00\x04\x00' b'\x05\x00\x06\x00' \
1127
+            b'\x07\x00\x08\x00' b'\x09\x00\x0a\x00'
1128
 
1129
         self.evt_args_2 = {
1130
             'type': 243,
1131
@@ -804,14 +806,14 @@
1132
             'data': (32, [1, 2, 3, 4, 5]),
1133
             'sequence_number': 63569,
1134
             }
1135
-        self.evt_bin_2 = '\xf3\x20\x51\xf8' '\x46\x88\xaf\x22' \
1136
-            '\xfe\x65\xa1\x39' '\x01\x00\x00\x00' \
1137
-            '\x02\x00\x00\x00' '\x03\x00\x00\x00' \
1138
-            '\x04\x00\x00\x00' '\x05\x00\x00\x00'
1139
+        self.evt_bin_2 = b'\xf3\x20\x51\xf8' b'\x46\x88\xaf\x22' \
1140
+            b'\xfe\x65\xa1\x39' b'\x01\x00\x00\x00' \
1141
+            b'\x02\x00\x00\x00' b'\x03\x00\x00\x00' \
1142
+            b'\x04\x00\x00\x00' b'\x05\x00\x00\x00'
1143
 
1144
 
1145
     def testPack0(self):
1146
-        bin = apply(event.ClientMessage._fields.to_binary, (), self.evt_args_0)
1147
+        bin = event.ClientMessage._fields.to_binary(*(), **self.evt_args_0)
1148
         try:
1149
             assert bin == self.evt_bin_0
1150
         except AssertionError:
1151
@@ -829,7 +831,7 @@
1152
             raise AssertionError(args)
1153
 
1154
     def testPack1(self):
1155
-        bin = apply(event.ClientMessage._fields.to_binary, (), self.evt_args_1)
1156
+        bin = event.ClientMessage._fields.to_binary(*(), **self.evt_args_1)
1157
         try:
1158
             assert bin == self.evt_bin_1
1159
         except AssertionError:
1160
@@ -847,7 +849,7 @@
1161
             raise AssertionError(args)
1162
 
1163
     def testPack2(self):
1164
-        bin = apply(event.ClientMessage._fields.to_binary, (), self.evt_args_2)
1165
+        bin = event.ClientMessage._fields.to_binary(*(), **self.evt_args_2)
1166
         try:
1167
             assert bin == self.evt_bin_2
1168
         except AssertionError:
1169
@@ -874,14 +876,14 @@
1170
             'count': 201,
1171
             'sequence_number': 32665,
1172
             }
1173
-        self.evt_bin_0 = '\xc6\x00\x99\x7f' '\xbd\xf6\xc9\x00' \
1174
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
1175
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
1176
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
1177
+        self.evt_bin_0 = b'\xc6\x00\x99\x7f' b'\xbd\xf6\xc9\x00' \
1178
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
1179
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
1180
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
1181
 
1182
 
1183
     def testPack0(self):
1184
-        bin = apply(event.MappingNotify._fields.to_binary, (), self.evt_args_0)
1185
+        bin = event.MappingNotify._fields.to_binary(*(), **self.evt_args_0)
1186
         try:
1187
             assert bin == self.evt_bin_0
1188
         except AssertionError:
1189
diff -Naur python-xlib-0.15rc1.orig.orig/test/test_requests_be.py python-xlib-0.15rc1.orig/test/test_requests_be.py
1190
--- python-xlib-0.15rc1.orig.orig/test/test_requests_be.py	2015-06-03 21:47:39.000000000 +0300
1191
+++ python-xlib-0.15rc1.orig/test/test_requests_be.py	2015-06-03 21:47:43.000000000 +0300
1192
@@ -3,7 +3,6 @@
1193
 import sys, os
1194
 sys.path.insert(1, os.path.join(sys.path[0], '..'))
1195
 
1196
-import string
1197
 import unittest
1198
 from Xlib.protocol import request, rq, event
1199
 import Xlib.protocol.event
1200
@@ -13,7 +12,7 @@
1201
 
1202
 class CmpArray:
1203
     def __init__(self, *args, **kws):
1204
-        self.array = apply(array.array, args, kws)
1205
+        self.array = array.array(*args, **kws)
1206
 
1207
     def __len__(self):
1208
         return len(self.array)
1209
@@ -21,16 +20,25 @@
1210
     def __getslice__(self, x, y):
1211
         return list(self.array[x:y])
1212
 
1213
+    def __getitem__(self, n):
1214
+        if isinstance(n, slice):
1215
+            return list(self.array.__getitem__(n))
1216
+        else:
1217
+            return self.array[n]
1218
+
1219
     def __getattr__(self, attr):
1220
         return getattr(self.array, attr)
1221
 
1222
-    def __cmp__(self, other):
1223
-        return cmp(self.array.tolist(), other)
1224
+    def __eq__(self, other):
1225
+        return self.array.tolist() == other
1226
+
1227
+    def __ne__(self, other):
1228
+        return self.array.tolist() != other
1229
 
1230
 rq.array = CmpArray
1231
 
1232
 def tohex(bin):
1233
-    bin = string.join(map(lambda c: '\\x%02x' % ord(c), bin), '')
1234
+    bin = ''.join(map(lambda c: '\\x%02x' % c, bin))
1235
 
1236
     bins = []
1237
     for i in range(0, len(bin), 16):
1238
@@ -43,7 +51,7 @@
1239
         except IndexError:
1240
             bins2.append("'%s'" % bins[i])
1241
 
1242
-    return string.join(bins2, ' \\\n            ')
1243
+    return ' \\\n            '.join(bins2)
1244
 
1245
 class DummyDisplay:
1246
     def get_resource_class(self, x):
1247
@@ -75,22 +83,22 @@
1248
             'depth': 186,
1249
             'width': 51466,
1250
             }
1251
-        self.req_bin_0 = '\x01\xba\x00\x17' '\x6d\x03\x01\x24' \
1252
-            '\x74\xdb\x41\x4e' '\xae\xdd\xf0\x2f' \
1253
-            '\xc9\x0a\x96\xd0' '\x86\x93\x00\x00' \
1254
-            '\x17\xba\x10\x13' '\x00\x00\x7f\xff' \
1255
-            '\x5e\x67\x63\x43' '\x0c\x77\x07\x07' \
1256
-            '\x76\xc4\x0c\xaa' '\x7f\x48\x9d\x8c' \
1257
-            '\x00\x00\x00\x00' '\x03\x00\x00\x00' \
1258
-            '\x02\x00\x00\x00' '\x56\xac\x9b\x9d' \
1259
-            '\x21\x76\x49\x57' '\x00\x00\x00\x00' \
1260
-            '\x00\x00\x00\x00' '\x15\xf2\xee\x1c' \
1261
-            '\x23\x97\xad\x71' '\x16\x7e\xec\x01' \
1262
-            '\x55\xfd\xbc\xc5'
1263
+        self.req_bin_0 = b'\x01\xba\x00\x17' b'\x6d\x03\x01\x24' \
1264
+            b'\x74\xdb\x41\x4e' b'\xae\xdd\xf0\x2f' \
1265
+            b'\xc9\x0a\x96\xd0' b'\x86\x93\x00\x00' \
1266
+            b'\x17\xba\x10\x13' b'\x00\x00\x7f\xff' \
1267
+            b'\x5e\x67\x63\x43' b'\x0c\x77\x07\x07' \
1268
+            b'\x76\xc4\x0c\xaa' b'\x7f\x48\x9d\x8c' \
1269
+            b'\x00\x00\x00\x00' b'\x03\x00\x00\x00' \
1270
+            b'\x02\x00\x00\x00' b'\x56\xac\x9b\x9d' \
1271
+            b'\x21\x76\x49\x57' b'\x00\x00\x00\x00' \
1272
+            b'\x00\x00\x00\x00' b'\x15\xf2\xee\x1c' \
1273
+            b'\x23\x97\xad\x71' b'\x16\x7e\xec\x01' \
1274
+            b'\x55\xfd\xbc\xc5'
1275
 
1276
 
1277
     def testPackRequest0(self):
1278
-        bin = apply(request.CreateWindow._request.to_binary, (), self.req_args_0)
1279
+        bin = request.CreateWindow._request.to_binary(*(), **self.req_args_0)
1280
         try:
1281
             assert bin == self.req_bin_0
1282
         except AssertionError:
1283
@@ -114,19 +122,19 @@
1284
             'window': 1813552124,
1285
             'attrs': {'backing_pixel': 59516078, 'cursor': 1682969315, 'background_pixmap': 370313360, 'border_pixmap': 1158771722, 'backing_planes': 1432315664, 'win_gravity': 3, 'backing_store': 1, 'event_mask': 1054128649, 'save_under': 0, 'background_pixel': 1953340842, 'colormap': 1462101672, 'border_pixel': 287436510, 'bit_gravity': 10, 'do_not_propagate_mask': 1283834625, 'override_redirect': 0},
1286
             }
1287
-        self.req_bin_0 = '\x02\x00\x00\x12' '\x6c\x18\x9b\xfc' \
1288
-            '\x00\x00\x7f\xff' '\x16\x12\x88\x90' \
1289
-            '\x74\x6d\x9d\xaa' '\x45\x11\x74\x0a' \
1290
-            '\x11\x21\xee\xde' '\x0a\x00\x00\x00' \
1291
-            '\x03\x00\x00\x00' '\x01\x00\x00\x00' \
1292
-            '\x55\x5f\x67\x10' '\x03\x8c\x24\xae' \
1293
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
1294
-            '\x3e\xd4\xba\x09' '\x4c\x85\xc3\x01' \
1295
-            '\x57\x25\xe6\xa8' '\x64\x50\x12\xe3'
1296
+        self.req_bin_0 = b'\x02\x00\x00\x12' b'\x6c\x18\x9b\xfc' \
1297
+            b'\x00\x00\x7f\xff' b'\x16\x12\x88\x90' \
1298
+            b'\x74\x6d\x9d\xaa' b'\x45\x11\x74\x0a' \
1299
+            b'\x11\x21\xee\xde' b'\x0a\x00\x00\x00' \
1300
+            b'\x03\x00\x00\x00' b'\x01\x00\x00\x00' \
1301
+            b'\x55\x5f\x67\x10' b'\x03\x8c\x24\xae' \
1302
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
1303
+            b'\x3e\xd4\xba\x09' b'\x4c\x85\xc3\x01' \
1304
+            b'\x57\x25\xe6\xa8' b'\x64\x50\x12\xe3'
1305
 
1306
 
1307
     def testPackRequest0(self):
1308
-        bin = apply(request.ChangeWindowAttributes._request.to_binary, (), self.req_args_0)
1309
+        bin = request.ChangeWindowAttributes._request.to_binary(*(), **self.req_args_0)
1310
         try:
1311
             assert bin == self.req_bin_0
1312
         except AssertionError:
1313
@@ -149,7 +157,7 @@
1314
         self.req_args_0 = {
1315
             'window': 1931593850,
1316
             }
1317
-        self.req_bin_0 = '\x03\x00\x00\x02' '\x73\x21\xc8\x7a'
1318
+        self.req_bin_0 = b'\x03\x00\x00\x02' b'\x73\x21\xc8\x7a'
1319
 
1320
         self.reply_args_0 = {
1321
             'sequence_number': 60057,
1322
@@ -169,16 +177,16 @@
1323
             'do_not_propagate_mask': 33787,
1324
             'override_redirect': 0,
1325
             }
1326
-        self.reply_bin_0 = '\x01\x93\xea\x99' '\x00\x00\x00\x03' \
1327
-            '\x28\xf8\xb5\x19' '\x47\x6c\xfd\x9d' \
1328
-            '\x3b\x04\x67\x99' '\x08\x23\xc5\x49' \
1329
-            '\x00\x00\xb9\x00' '\x45\x39\x51\x8e' \
1330
-            '\x10\x1b\x49\x0c' '\x4f\x6a\xcc\x0f' \
1331
-            '\x83\xfb\x00\x00'
1332
+        self.reply_bin_0 = b'\x01\x93\xea\x99' b'\x00\x00\x00\x03' \
1333
+            b'\x28\xf8\xb5\x19' b'\x47\x6c\xfd\x9d' \
1334
+            b'\x3b\x04\x67\x99' b'\x08\x23\xc5\x49' \
1335
+            b'\x00\x00\xb9\x00' b'\x45\x39\x51\x8e' \
1336
+            b'\x10\x1b\x49\x0c' b'\x4f\x6a\xcc\x0f' \
1337
+            b'\x83\xfb\x00\x00'
1338
 
1339
 
1340
     def testPackRequest0(self):
1341
-        bin = apply(request.GetWindowAttributes._request.to_binary, (), self.req_args_0)
1342
+        bin = request.GetWindowAttributes._request.to_binary(*(), **self.req_args_0)
1343
         try:
1344
             assert bin == self.req_bin_0
1345
         except AssertionError:
1346
@@ -196,7 +204,7 @@
1347
             raise AssertionError(args)
1348
 
1349
     def testPackReply0(self):
1350
-        bin = apply(request.GetWindowAttributes._reply.to_binary, (), self.reply_args_0)
1351
+        bin = request.GetWindowAttributes._reply.to_binary(*(), **self.reply_args_0)
1352
         try:
1353
             assert bin == self.reply_bin_0
1354
         except AssertionError:
1355
@@ -219,11 +227,11 @@
1356
         self.req_args_0 = {
1357
             'window': 1622184267,
1358
             }
1359
-        self.req_bin_0 = '\x04\x00\x00\x02' '\x60\xb0\x91\x4b'
1360
+        self.req_bin_0 = b'\x04\x00\x00\x02' b'\x60\xb0\x91\x4b'
1361
 
1362
 
1363
     def testPackRequest0(self):
1364
-        bin = apply(request.DestroyWindow._request.to_binary, (), self.req_args_0)
1365
+        bin = request.DestroyWindow._request.to_binary(*(), **self.req_args_0)
1366
         try:
1367
             assert bin == self.req_bin_0
1368
         except AssertionError:
1369
@@ -246,11 +254,11 @@
1370
         self.req_args_0 = {
1371
             'window': 1000376476,
1372
             }
1373
-        self.req_bin_0 = '\x05\x00\x00\x02' '\x3b\xa0\x88\x9c'
1374
+        self.req_bin_0 = b'\x05\x00\x00\x02' b'\x3b\xa0\x88\x9c'
1375
 
1376
 
1377
     def testPackRequest0(self):
1378
-        bin = apply(request.DestroySubWindows._request.to_binary, (), self.req_args_0)
1379
+        bin = request.DestroySubWindows._request.to_binary(*(), **self.req_args_0)
1380
         try:
1381
             assert bin == self.req_bin_0
1382
         except AssertionError:
1383
@@ -274,11 +282,11 @@
1384
             'window': 1577523459,
1385
             'mode': 0,
1386
             }
1387
-        self.req_bin_0 = '\x06\x00\x00\x02' '\x5e\x07\x19\x03'
1388
+        self.req_bin_0 = b'\x06\x00\x00\x02' b'\x5e\x07\x19\x03'
1389
 
1390
 
1391
     def testPackRequest0(self):
1392
-        bin = apply(request.ChangeSaveSet._request.to_binary, (), self.req_args_0)
1393
+        bin = request.ChangeSaveSet._request.to_binary(*(), **self.req_args_0)
1394
         try:
1395
             assert bin == self.req_bin_0
1396
         except AssertionError:
1397
@@ -304,12 +312,12 @@
1398
             'x': -5207,
1399
             'y': -22675,
1400
             }
1401
-        self.req_bin_0 = '\x07\x00\x00\x04' '\x4d\x87\xa0\xa0' \
1402
-            '\x04\x4d\x83\x68' '\xeb\xa9\xa7\x6d'
1403
+        self.req_bin_0 = b'\x07\x00\x00\x04' b'\x4d\x87\xa0\xa0' \
1404
+            b'\x04\x4d\x83\x68' b'\xeb\xa9\xa7\x6d'
1405
 
1406
 
1407
     def testPackRequest0(self):
1408
-        bin = apply(request.ReparentWindow._request.to_binary, (), self.req_args_0)
1409
+        bin = request.ReparentWindow._request.to_binary(*(), **self.req_args_0)
1410
         try:
1411
             assert bin == self.req_bin_0
1412
         except AssertionError:
1413
@@ -332,11 +340,11 @@
1414
         self.req_args_0 = {
1415
             'window': 61469476,
1416
             }
1417
-        self.req_bin_0 = '\x08\x00\x00\x02' '\x03\xa9\xf3\x24'
1418
+        self.req_bin_0 = b'\x08\x00\x00\x02' b'\x03\xa9\xf3\x24'
1419
 
1420
 
1421
     def testPackRequest0(self):
1422
-        bin = apply(request.MapWindow._request.to_binary, (), self.req_args_0)
1423
+        bin = request.MapWindow._request.to_binary(*(), **self.req_args_0)
1424
         try:
1425
             assert bin == self.req_bin_0
1426
         except AssertionError:
1427
@@ -359,11 +367,11 @@
1428
         self.req_args_0 = {
1429
             'window': 818738118,
1430
             }
1431
-        self.req_bin_0 = '\x09\x00\x00\x02' '\x30\xcc\xf3\xc6'
1432
+        self.req_bin_0 = b'\x09\x00\x00\x02' b'\x30\xcc\xf3\xc6'
1433
 
1434
 
1435
     def testPackRequest0(self):
1436
-        bin = apply(request.MapSubwindows._request.to_binary, (), self.req_args_0)
1437
+        bin = request.MapSubwindows._request.to_binary(*(), **self.req_args_0)
1438
         try:
1439
             assert bin == self.req_bin_0
1440
         except AssertionError:
1441
@@ -386,11 +394,11 @@
1442
         self.req_args_0 = {
1443
             'window': 1923663468,
1444
             }
1445
-        self.req_bin_0 = '\x0a\x00\x00\x02' '\x72\xa8\xc6\x6c'
1446
+        self.req_bin_0 = b'\x0a\x00\x00\x02' b'\x72\xa8\xc6\x6c'
1447
 
1448
 
1449
     def testPackRequest0(self):
1450
-        bin = apply(request.UnmapWindow._request.to_binary, (), self.req_args_0)
1451
+        bin = request.UnmapWindow._request.to_binary(*(), **self.req_args_0)
1452
         try:
1453
             assert bin == self.req_bin_0
1454
         except AssertionError:
1455
@@ -413,11 +421,11 @@
1456
         self.req_args_0 = {
1457
             'window': 999740194,
1458
             }
1459
-        self.req_bin_0 = '\x0b\x00\x00\x02' '\x3b\x96\xd3\x22'
1460
+        self.req_bin_0 = b'\x0b\x00\x00\x02' b'\x3b\x96\xd3\x22'
1461
 
1462
 
1463
     def testPackRequest0(self):
1464
-        bin = apply(request.UnmapSubwindows._request.to_binary, (), self.req_args_0)
1465
+        bin = request.UnmapSubwindows._request.to_binary(*(), **self.req_args_0)
1466
         try:
1467
             assert bin == self.req_bin_0
1468
         except AssertionError:
1469
@@ -441,15 +449,15 @@
1470
             'window': 190634459,
1471
             'attrs': {'height': 57788, 'stack_mode': 2, 'border_width': -320, 'width': 53674, 'x': -2248, 'y': -29960, 'sibling': 1012823324},
1472
             }
1473
-        self.req_bin_0 = '\x0c\x00\x00\x0a' '\x0b\x5c\xd9\xdb' \
1474
-            '\x00\x7f\x00\x00' '\xf7\x38\x00\x00' \
1475
-            '\x8a\xf8\x00\x00' '\xd1\xaa\x00\x00' \
1476
-            '\xe1\xbc\x00\x00' '\xfe\xc0\x00\x00' \
1477
-            '\x3c\x5e\x75\x1c' '\x02\x00\x00\x00'
1478
+        self.req_bin_0 = b'\x0c\x00\x00\x0a' b'\x0b\x5c\xd9\xdb' \
1479
+            b'\x00\x7f\x00\x00' b'\xf7\x38\x00\x00' \
1480
+            b'\x8a\xf8\x00\x00' b'\xd1\xaa\x00\x00' \
1481
+            b'\xe1\xbc\x00\x00' b'\xfe\xc0\x00\x00' \
1482
+            b'\x3c\x5e\x75\x1c' b'\x02\x00\x00\x00'
1483
 
1484
 
1485
     def testPackRequest0(self):
1486
-        bin = apply(request.ConfigureWindow._request.to_binary, (), self.req_args_0)
1487
+        bin = request.ConfigureWindow._request.to_binary(*(), **self.req_args_0)
1488
         try:
1489
             assert bin == self.req_bin_0
1490
         except AssertionError:
1491
@@ -473,11 +481,11 @@
1492
             'window': 1712979067,
1493
             'direction': 1,
1494
             }
1495
-        self.req_bin_0 = '\x0d\x01\x00\x02' '\x66\x19\xfc\x7b'
1496
+        self.req_bin_0 = b'\x0d\x01\x00\x02' b'\x66\x19\xfc\x7b'
1497
 
1498
 
1499
     def testPackRequest0(self):
1500
-        bin = apply(request.CirculateWindow._request.to_binary, (), self.req_args_0)
1501
+        bin = request.CirculateWindow._request.to_binary(*(), **self.req_args_0)
1502
         try:
1503
             assert bin == self.req_bin_0
1504
         except AssertionError:
1505
@@ -500,7 +508,7 @@
1506
         self.req_args_0 = {
1507
             'drawable': 680179490,
1508
             }
1509
-        self.req_bin_0 = '\x0e\x00\x00\x02' '\x28\x8a\xb7\x22'
1510
+        self.req_bin_0 = b'\x0e\x00\x00\x02' b'\x28\x8a\xb7\x22'
1511
 
1512
         self.reply_args_0 = {
1513
             'height': 64954,
1514
@@ -512,14 +520,14 @@
1515
             'depth': 204,
1516
             'width': 38433,
1517
             }
1518
-        self.reply_bin_0 = '\x01\xcc\x9a\x2d' '\x00\x00\x00\x00' \
1519
-            '\x24\x55\x8d\x71' '\xfb\x1b\xd4\x54' \
1520
-            '\x96\x21\xfd\xba' '\x01\xf0\x00\x00' \
1521
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
1522
+        self.reply_bin_0 = b'\x01\xcc\x9a\x2d' b'\x00\x00\x00\x00' \
1523
+            b'\x24\x55\x8d\x71' b'\xfb\x1b\xd4\x54' \
1524
+            b'\x96\x21\xfd\xba' b'\x01\xf0\x00\x00' \
1525
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
1526
 
1527
 
1528
     def testPackRequest0(self):
1529
-        bin = apply(request.GetGeometry._request.to_binary, (), self.req_args_0)
1530
+        bin = request.GetGeometry._request.to_binary(*(), **self.req_args_0)
1531
         try:
1532
             assert bin == self.req_bin_0
1533
         except AssertionError:
1534
@@ -537,7 +545,7 @@
1535
             raise AssertionError(args)
1536
 
1537
     def testPackReply0(self):
1538
-        bin = apply(request.GetGeometry._reply.to_binary, (), self.reply_args_0)
1539
+        bin = request.GetGeometry._reply.to_binary(*(), **self.reply_args_0)
1540
         try:
1541
             assert bin == self.reply_bin_0
1542
         except AssertionError:
1543
@@ -560,7 +568,7 @@
1544
         self.req_args_0 = {
1545
             'window': 2052496265,
1546
             }
1547
-        self.req_bin_0 = '\x0f\x00\x00\x02' '\x7a\x56\x9b\x89'
1548
+        self.req_bin_0 = b'\x0f\x00\x00\x02' b'\x7a\x56\x9b\x89'
1549
 
1550
         self.reply_args_0 = {
1551
             'sequence_number': 33887,
1552
@@ -568,18 +576,18 @@
1553
             'root': 1856577120,
1554
             'parent': 2105827407,
1555
             }
1556
-        self.reply_bin_0 = '\x01\x00\x84\x5f' '\x00\x00\x00\x07' \
1557
-            '\x6e\xa9\x1e\x60' '\x7d\x84\x60\x4f' \
1558
-            '\x00\x07\x00\x00' '\x00\x00\x00\x00' \
1559
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
1560
-            '\x6b\x09\x3d\x72' '\x59\x14\x21\xa5' \
1561
-            '\x2c\x9a\x2c\x42' '\x2b\x7b\x78\xa1' \
1562
-            '\x4b\x39\x79\x79' '\x03\xd4\x32\x73' \
1563
-            '\x40\xdd\x8e\x53'
1564
+        self.reply_bin_0 = b'\x01\x00\x84\x5f' b'\x00\x00\x00\x07' \
1565
+            b'\x6e\xa9\x1e\x60' b'\x7d\x84\x60\x4f' \
1566
+            b'\x00\x07\x00\x00' b'\x00\x00\x00\x00' \
1567
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
1568
+            b'\x6b\x09\x3d\x72' b'\x59\x14\x21\xa5' \
1569
+            b'\x2c\x9a\x2c\x42' b'\x2b\x7b\x78\xa1' \
1570
+            b'\x4b\x39\x79\x79' b'\x03\xd4\x32\x73' \
1571
+            b'\x40\xdd\x8e\x53'
1572
 
1573
 
1574
     def testPackRequest0(self):
1575
-        bin = apply(request.QueryTree._request.to_binary, (), self.req_args_0)
1576
+        bin = request.QueryTree._request.to_binary(*(), **self.req_args_0)
1577
         try:
1578
             assert bin == self.req_bin_0
1579
         except AssertionError:
1580
@@ -597,7 +605,7 @@
1581
             raise AssertionError(args)
1582
 
1583
     def testPackReply0(self):
1584
-        bin = apply(request.QueryTree._reply.to_binary, (), self.reply_args_0)
1585
+        bin = request.QueryTree._reply.to_binary(*(), **self.reply_args_0)
1586
         try:
1587
             assert bin == self.reply_bin_0
1588
         except AssertionError:
1589
@@ -621,22 +629,22 @@
1590
             'only_if_exists': 0,
1591
             'name': 'fuzzy_prop',
1592
             }
1593
-        self.req_bin_0 = '\x10\x00\x00\x05' '\x00\x0a\x00\x00' \
1594
-            '\x66\x75\x7a\x7a' '\x79\x5f\x70\x72' \
1595
-            '\x6f\x70\x00\x00'
1596
+        self.req_bin_0 = b'\x10\x00\x00\x05' b'\x00\x0a\x00\x00' \
1597
+            b'\x66\x75\x7a\x7a' b'\x79\x5f\x70\x72' \
1598
+            b'\x6f\x70\x00\x00'
1599
 
1600
         self.reply_args_0 = {
1601
             'atom': 48723297,
1602
             'sequence_number': 35223,
1603
             }
1604
-        self.reply_bin_0 = '\x01\x00\x89\x97' '\x00\x00\x00\x00' \
1605
-            '\x02\xe7\x75\x61' '\x00\x00\x00\x00' \
1606
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
1607
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
1608
+        self.reply_bin_0 = b'\x01\x00\x89\x97' b'\x00\x00\x00\x00' \
1609
+            b'\x02\xe7\x75\x61' b'\x00\x00\x00\x00' \
1610
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
1611
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
1612
 
1613
 
1614
     def testPackRequest0(self):
1615
-        bin = apply(request.InternAtom._request.to_binary, (), self.req_args_0)
1616
+        bin = request.InternAtom._request.to_binary(*(), **self.req_args_0)
1617
         try:
1618
             assert bin == self.req_bin_0
1619
         except AssertionError:
1620
@@ -654,7 +662,7 @@
1621
             raise AssertionError(args)
1622
 
1623
     def testPackReply0(self):
1624
-        bin = apply(request.InternAtom._reply.to_binary, (), self.reply_args_0)
1625
+        bin = request.InternAtom._reply.to_binary(*(), **self.reply_args_0)
1626
         try:
1627
             assert bin == self.reply_bin_0
1628
         except AssertionError:
1629
@@ -677,21 +685,21 @@
1630
         self.req_args_0 = {
1631
             'atom': 1022286544,
1632
             }
1633
-        self.req_bin_0 = '\x11\x00\x00\x02' '\x3c\xee\xda\xd0'
1634
+        self.req_bin_0 = b'\x11\x00\x00\x02' b'\x3c\xee\xda\xd0'
1635
 
1636
         self.reply_args_0 = {
1637
             'sequence_number': 22699,
1638
             'name': 'WM_CLASS',
1639
             }
1640
-        self.reply_bin_0 = '\x01\x00\x58\xab' '\x00\x00\x00\x02' \
1641
-            '\x00\x08\x00\x00' '\x00\x00\x00\x00' \
1642
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
1643
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
1644
-            '\x57\x4d\x5f\x43' '\x4c\x41\x53\x53'
1645
+        self.reply_bin_0 = b'\x01\x00\x58\xab' b'\x00\x00\x00\x02' \
1646
+            b'\x00\x08\x00\x00' b'\x00\x00\x00\x00' \
1647
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
1648
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
1649
+            b'\x57\x4d\x5f\x43' b'\x4c\x41\x53\x53'
1650
 
1651
 
1652
     def testPackRequest0(self):
1653
-        bin = apply(request.GetAtomName._request.to_binary, (), self.req_args_0)
1654
+        bin = request.GetAtomName._request.to_binary(*(), **self.req_args_0)
1655
         try:
1656
             assert bin == self.req_bin_0
1657
         except AssertionError:
1658
@@ -709,7 +717,7 @@
1659
             raise AssertionError(args)
1660
 
1661
     def testPackReply0(self):
1662
-        bin = apply(request.GetAtomName._reply.to_binary, (), self.reply_args_0)
1663
+        bin = request.GetAtomName._reply.to_binary(*(), **self.reply_args_0)
1664
         try:
1665
             assert bin == self.reply_bin_0
1666
         except AssertionError:
1667
@@ -736,9 +744,9 @@
1668
             'window': 266197951,
1669
             'type': 1343008022,
1670
             }
1671
-        self.req_bin_0 = '\x12\x00\x00\x06' '\x0f\xdd\xdb\xbf' \
1672
-            '\x7c\x4c\x97\x11' '\x50\x0c\xad\x16' \
1673
-            '\x08\x00\x00\x00' '\x00\x00\x00\x00'
1674
+        self.req_bin_0 = b'\x12\x00\x00\x06' b'\x0f\xdd\xdb\xbf' \
1675
+            b'\x7c\x4c\x97\x11' b'\x50\x0c\xad\x16' \
1676
+            b'\x08\x00\x00\x00' b'\x00\x00\x00\x00'
1677
 
1678
         self.req_args_1 = {
1679
             'mode': 2,
1680
@@ -747,10 +755,10 @@
1681
             'window': 1522118044,
1682
             'type': 121096013,
1683
             }
1684
-        self.req_bin_1 = '\x12\x02\x00\x07' '\x5a\xb9\xad\x9c' \
1685
-            '\x1a\xce\x2e\xab' '\x07\x37\xc7\x4d' \
1686
-            '\x08\x00\x00\x00' '\x00\x00\x00\x03' \
1687
-            '\x66\x6f\x6f\x00'
1688
+        self.req_bin_1 = b'\x12\x02\x00\x07' b'\x5a\xb9\xad\x9c' \
1689
+            b'\x1a\xce\x2e\xab' b'\x07\x37\xc7\x4d' \
1690
+            b'\x08\x00\x00\x00' b'\x00\x00\x00\x03' \
1691
+            b'\x66\x6f\x6f\x00'
1692
 
1693
         self.req_args_2 = {
1694
             'mode': 2,
1695
@@ -759,10 +767,10 @@
1696
             'window': 286324270,
1697
             'type': 1547457396,
1698
             }
1699
-        self.req_bin_2 = '\x12\x02\x00\x07' '\x11\x10\xf6\x2e' \
1700
-            '\x3c\x30\xf5\x5a' '\x5c\x3c\x53\x74' \
1701
-            '\x08\x00\x00\x00' '\x00\x00\x00\x04' \
1702
-            '\x7a\x6f\x6f\x6d'
1703
+        self.req_bin_2 = b'\x12\x02\x00\x07' b'\x11\x10\xf6\x2e' \
1704
+            b'\x3c\x30\xf5\x5a' b'\x5c\x3c\x53\x74' \
1705
+            b'\x08\x00\x00\x00' b'\x00\x00\x00\x04' \
1706
+            b'\x7a\x6f\x6f\x6d'
1707
 
1708
         self.req_args_3 = {
1709
             'mode': 0,
1710
@@ -771,9 +779,9 @@
1711
             'window': 1964921608,
1712
             'type': 692879036,
1713
             }
1714
-        self.req_bin_3 = '\x12\x00\x00\x06' '\x75\x1e\x53\x08' \
1715
-            '\x19\x73\x3e\xc0' '\x29\x4c\x7e\xbc' \
1716
-            '\x10\x00\x00\x00' '\x00\x00\x00\x00'
1717
+        self.req_bin_3 = b'\x12\x00\x00\x06' b'\x75\x1e\x53\x08' \
1718
+            b'\x19\x73\x3e\xc0' b'\x29\x4c\x7e\xbc' \
1719
+            b'\x10\x00\x00\x00' b'\x00\x00\x00\x00'
1720
 
1721
         self.req_args_4 = {
1722
             'mode': 0,
1723
@@ -782,10 +790,10 @@
1724
             'window': 560040176,
1725
             'type': 2030208993,
1726
             }
1727
-        self.req_bin_4 = '\x12\x00\x00\x08' '\x21\x61\x88\xf0' \
1728
-            '\x2f\xbe\x64\xa4' '\x79\x02\x87\xe1' \
1729
-            '\x10\x00\x00\x00' '\x00\x00\x00\x03' \
1730
-            '\x00\x01\x00\x02' '\x00\x03\x00\x00'
1731
+        self.req_bin_4 = b'\x12\x00\x00\x08' b'\x21\x61\x88\xf0' \
1732
+            b'\x2f\xbe\x64\xa4' b'\x79\x02\x87\xe1' \
1733
+            b'\x10\x00\x00\x00' b'\x00\x00\x00\x03' \
1734
+            b'\x00\x01\x00\x02' b'\x00\x03\x00\x00'
1735
 
1736
         self.req_args_5 = {
1737
             'mode': 0,
1738
@@ -794,10 +802,10 @@
1739
             'window': 2016421454,
1740
             'type': 434059096,
1741
             }
1742
-        self.req_bin_5 = '\x12\x00\x00\x08' '\x78\x30\x26\x4e' \
1743
-            '\x53\x8c\x0f\x22' '\x19\xdf\x37\x58' \
1744
-            '\x10\x00\x00\x00' '\x00\x00\x00\x04' \
1745
-            '\x00\x01\x00\x02' '\x00\x03\x00\x04'
1746
+        self.req_bin_5 = b'\x12\x00\x00\x08' b'\x78\x30\x26\x4e' \
1747
+            b'\x53\x8c\x0f\x22' b'\x19\xdf\x37\x58' \
1748
+            b'\x10\x00\x00\x00' b'\x00\x00\x00\x04' \
1749
+            b'\x00\x01\x00\x02' b'\x00\x03\x00\x04'
1750
 
1751
         self.req_args_6 = {
1752
             'mode': 2,
1753
@@ -806,9 +814,9 @@
1754
             'window': 461926013,
1755
             'type': 613217208,
1756
             }
1757
-        self.req_bin_6 = '\x12\x02\x00\x06' '\x1b\x88\x6e\x7d' \
1758
-            '\x3c\x23\x1c\xbb' '\x24\x8c\xf3\xb8' \
1759
-            '\x20\x00\x00\x00' '\x00\x00\x00\x00'
1760
+        self.req_bin_6 = b'\x12\x02\x00\x06' b'\x1b\x88\x6e\x7d' \
1761
+            b'\x3c\x23\x1c\xbb' b'\x24\x8c\xf3\xb8' \
1762
+            b'\x20\x00\x00\x00' b'\x00\x00\x00\x00'
1763
 
1764
         self.req_args_7 = {
1765
             'mode': 1,
1766
@@ -817,15 +825,15 @@
1767
             'window': 367636986,
1768
             'type': 1085552939,
1769
             }
1770
-        self.req_bin_7 = '\x12\x01\x00\x09' '\x15\xe9\xb1\xfa' \
1771
-            '\x57\xc4\x9f\x58' '\x40\xb4\x39\x2b' \
1772
-            '\x20\x00\x00\x00' '\x00\x00\x00\x03' \
1773
-            '\x00\x00\x00\x01' '\x00\x00\x00\x02' \
1774
-            '\x00\x00\x00\x03'
1775
+        self.req_bin_7 = b'\x12\x01\x00\x09' b'\x15\xe9\xb1\xfa' \
1776
+            b'\x57\xc4\x9f\x58' b'\x40\xb4\x39\x2b' \
1777
+            b'\x20\x00\x00\x00' b'\x00\x00\x00\x03' \
1778
+            b'\x00\x00\x00\x01' b'\x00\x00\x00\x02' \
1779
+            b'\x00\x00\x00\x03'
1780
 
1781
 
1782
     def testPackRequest0(self):
1783
-        bin = apply(request.ChangeProperty._request.to_binary, (), self.req_args_0)
1784
+        bin = request.ChangeProperty._request.to_binary(*(), **self.req_args_0)
1785
         try:
1786
             assert bin == self.req_bin_0
1787
         except AssertionError:
1788
@@ -843,7 +851,7 @@
1789
             raise AssertionError(args)
1790
 
1791
     def testPackRequest1(self):
1792
-        bin = apply(request.ChangeProperty._request.to_binary, (), self.req_args_1)
1793
+        bin = request.ChangeProperty._request.to_binary(*(), **self.req_args_1)
1794
         try:
1795
             assert bin == self.req_bin_1
1796
         except AssertionError:
1797
@@ -861,7 +869,7 @@
1798
             raise AssertionError(args)
1799
 
1800
     def testPackRequest2(self):
1801
-        bin = apply(request.ChangeProperty._request.to_binary, (), self.req_args_2)
1802
+        bin = request.ChangeProperty._request.to_binary(*(), **self.req_args_2)
1803
         try:
1804
             assert bin == self.req_bin_2
1805
         except AssertionError:
1806
@@ -879,7 +887,7 @@
1807
             raise AssertionError(args)
1808
 
1809
     def testPackRequest3(self):
1810
-        bin = apply(request.ChangeProperty._request.to_binary, (), self.req_args_3)
1811
+        bin = request.ChangeProperty._request.to_binary(*(), **self.req_args_3)
1812
         try:
1813
             assert bin == self.req_bin_3
1814
         except AssertionError:
1815
@@ -897,7 +905,7 @@
1816
             raise AssertionError(args)
1817
 
1818
     def testPackRequest4(self):
1819
-        bin = apply(request.ChangeProperty._request.to_binary, (), self.req_args_4)
1820
+        bin = request.ChangeProperty._request.to_binary(*(), **self.req_args_4)
1821
         try:
1822
             assert bin == self.req_bin_4
1823
         except AssertionError:
1824
@@ -915,7 +923,7 @@
1825
             raise AssertionError(args)
1826
 
1827
     def testPackRequest5(self):
1828
-        bin = apply(request.ChangeProperty._request.to_binary, (), self.req_args_5)
1829
+        bin = request.ChangeProperty._request.to_binary(*(), **self.req_args_5)
1830
         try:
1831
             assert bin == self.req_bin_5
1832
         except AssertionError:
1833
@@ -933,7 +941,7 @@
1834
             raise AssertionError(args)
1835
 
1836
     def testPackRequest6(self):
1837
-        bin = apply(request.ChangeProperty._request.to_binary, (), self.req_args_6)
1838
+        bin = request.ChangeProperty._request.to_binary(*(), **self.req_args_6)
1839
         try:
1840
             assert bin == self.req_bin_6
1841
         except AssertionError:
1842
@@ -951,7 +959,7 @@
1843
             raise AssertionError(args)
1844
 
1845
     def testPackRequest7(self):
1846
-        bin = apply(request.ChangeProperty._request.to_binary, (), self.req_args_7)
1847
+        bin = request.ChangeProperty._request.to_binary(*(), **self.req_args_7)
1848
         try:
1849
             assert bin == self.req_bin_7
1850
         except AssertionError:
1851
@@ -975,12 +983,12 @@
1852
             'property': 506897017,
1853
             'window': 381870530,
1854
             }
1855
-        self.req_bin_0 = '\x13\x00\x00\x03' '\x16\xc2\xe1\xc2' \
1856
-            '\x1e\x36\xa2\x79'
1857
+        self.req_bin_0 = b'\x13\x00\x00\x03' b'\x16\xc2\xe1\xc2' \
1858
+            b'\x1e\x36\xa2\x79'
1859
 
1860
 
1861
     def testPackRequest0(self):
1862
-        bin = apply(request.DeleteProperty._request.to_binary, (), self.req_args_0)
1863
+        bin = request.DeleteProperty._request.to_binary(*(), **self.req_args_0)
1864
         try:
1865
             assert bin == self.req_bin_0
1866
         except AssertionError:
1867
@@ -1008,9 +1016,9 @@
1868
             'window': 1477792536,
1869
             'long_length': 1346507413,
1870
             }
1871
-        self.req_bin_0 = '\x14\x00\x00\x06' '\x58\x15\x53\x18' \
1872
-            '\x3c\x11\x6b\x13' '\x5c\xc5\x9b\xa0' \
1873
-            '\x5d\x30\x8c\xce' '\x50\x42\x12\x95'
1874
+        self.req_bin_0 = b'\x14\x00\x00\x06' b'\x58\x15\x53\x18' \
1875
+            b'\x3c\x11\x6b\x13' b'\x5c\xc5\x9b\xa0' \
1876
+            b'\x5d\x30\x8c\xce' b'\x50\x42\x12\x95'
1877
 
1878
         self.reply_args_0 = {
1879
             'value': (8, ''),
1880
@@ -1018,10 +1026,10 @@
1881
             'property_type': 1392423916,
1882
             'bytes_after': 2046056935,
1883
             }
1884
-        self.reply_bin_0 = '\x01\x08\x77\x8e' '\x00\x00\x00\x00' \
1885
-            '\x52\xfe\xb3\xec' '\x79\xf4\x59\xe7' \
1886
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
1887
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
1888
+        self.reply_bin_0 = b'\x01\x08\x77\x8e' b'\x00\x00\x00\x00' \
1889
+            b'\x52\xfe\xb3\xec' b'\x79\xf4\x59\xe7' \
1890
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
1891
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
1892
 
1893
         self.reply_args_1 = {
1894
             'value': (8, 'foo'),
1895
@@ -1029,11 +1037,11 @@
1896
             'property_type': 186441230,
1897
             'bytes_after': 469299413,
1898
             }
1899
-        self.reply_bin_1 = '\x01\x08\xac\xf7' '\x00\x00\x00\x01' \
1900
-            '\x0b\x1c\xde\x0e' '\x1b\xf8\xf0\xd5' \
1901
-            '\x00\x00\x00\x03' '\x00\x00\x00\x00' \
1902
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
1903
-            '\x66\x6f\x6f\x00'
1904
+        self.reply_bin_1 = b'\x01\x08\xac\xf7' b'\x00\x00\x00\x01' \
1905
+            b'\x0b\x1c\xde\x0e' b'\x1b\xf8\xf0\xd5' \
1906
+            b'\x00\x00\x00\x03' b'\x00\x00\x00\x00' \
1907
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
1908
+            b'\x66\x6f\x6f\x00'
1909
 
1910
         self.reply_args_2 = {
1911
             'value': (8, 'zoom'),
1912
@@ -1041,11 +1049,11 @@
1913
             'property_type': 1802804296,
1914
             'bytes_after': 1968158856,
1915
             }
1916
-        self.reply_bin_2 = '\x01\x08\x31\x82' '\x00\x00\x00\x01' \
1917
-            '\x6b\x74\x9c\x48' '\x75\x4f\xb8\x88' \
1918
-            '\x00\x00\x00\x04' '\x00\x00\x00\x00' \
1919
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
1920
-            '\x7a\x6f\x6f\x6d'
1921
+        self.reply_bin_2 = b'\x01\x08\x31\x82' b'\x00\x00\x00\x01' \
1922
+            b'\x6b\x74\x9c\x48' b'\x75\x4f\xb8\x88' \
1923
+            b'\x00\x00\x00\x04' b'\x00\x00\x00\x00' \
1924
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
1925
+            b'\x7a\x6f\x6f\x6d'
1926
 
1927
         self.reply_args_3 = {
1928
             'value': (16, []),
1929
@@ -1053,10 +1061,10 @@
1930
             'property_type': 536196393,
1931
             'bytes_after': 1874157309,
1932
             }
1933
-        self.reply_bin_3 = '\x01\x10\x62\xdf' '\x00\x00\x00\x00' \
1934
-            '\x1f\xf5\xb5\x29' '\x6f\xb5\x5e\xfd' \
1935
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
1936
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
1937
+        self.reply_bin_3 = b'\x01\x10\x62\xdf' b'\x00\x00\x00\x00' \
1938
+            b'\x1f\xf5\xb5\x29' b'\x6f\xb5\x5e\xfd' \
1939
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
1940
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
1941
 
1942
         self.reply_args_4 = {
1943
             'value': (16, [1, 2, 3]),
1944
@@ -1064,11 +1072,11 @@
1945
             'property_type': 1046879880,
1946
             'bytes_after': 1952710167,
1947
             }
1948
-        self.reply_bin_4 = '\x01\x10\x58\x89' '\x00\x00\x00\x02' \
1949
-            '\x3e\x66\x1e\x88' '\x74\x63\xfe\x17' \
1950
-            '\x00\x00\x00\x03' '\x00\x00\x00\x00' \
1951
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
1952
-            '\x00\x01\x00\x02' '\x00\x03\x00\x00'
1953
+        self.reply_bin_4 = b'\x01\x10\x58\x89' b'\x00\x00\x00\x02' \
1954
+            b'\x3e\x66\x1e\x88' b'\x74\x63\xfe\x17' \
1955
+            b'\x00\x00\x00\x03' b'\x00\x00\x00\x00' \
1956
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
1957
+            b'\x00\x01\x00\x02' b'\x00\x03\x00\x00'
1958
 
1959
         self.reply_args_5 = {
1960
             'value': (16, [1, 2, 3, 4]),
1961
@@ -1076,11 +1084,11 @@
1962
             'property_type': 1014173132,
1963
             'bytes_after': 1791090668,
1964
             }
1965
-        self.reply_bin_5 = '\x01\x10\x4a\x54' '\x00\x00\x00\x02' \
1966
-            '\x3c\x73\x0d\xcc' '\x6a\xc1\xdf\xec' \
1967
-            '\x00\x00\x00\x04' '\x00\x00\x00\x00' \
1968
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
1969
-            '\x00\x01\x00\x02' '\x00\x03\x00\x04'
1970
+        self.reply_bin_5 = b'\x01\x10\x4a\x54' b'\x00\x00\x00\x02' \
1971
+            b'\x3c\x73\x0d\xcc' b'\x6a\xc1\xdf\xec' \
1972
+            b'\x00\x00\x00\x04' b'\x00\x00\x00\x00' \
1973
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
1974
+            b'\x00\x01\x00\x02' b'\x00\x03\x00\x04'
1975
 
1976
         self.reply_args_6 = {
1977
             'value': (32, []),
1978
@@ -1088,10 +1096,10 @@
1979
             'property_type': 2053870497,
1980
             'bytes_after': 1727548898,
1981
             }
1982
-        self.reply_bin_6 = '\x01\x20\xb8\x7a' '\x00\x00\x00\x00' \
1983
-            '\x7a\x6b\x93\xa1' '\x66\xf8\x4d\xe2' \
1984
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
1985
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
1986
+        self.reply_bin_6 = b'\x01\x20\xb8\x7a' b'\x00\x00\x00\x00' \
1987
+            b'\x7a\x6b\x93\xa1' b'\x66\xf8\x4d\xe2' \
1988
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
1989
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
1990
 
1991
         self.reply_args_7 = {
1992
             'value': (32, [1, 2, 3]),
1993
@@ -1099,16 +1107,16 @@
1994
             'property_type': 704363625,
1995
             'bytes_after': 1957409055,
1996
             }
1997
-        self.reply_bin_7 = '\x01\x20\x90\xe6' '\x00\x00\x00\x03' \
1998
-            '\x29\xfb\xbc\x69' '\x74\xab\xb1\x1f' \
1999
-            '\x00\x00\x00\x03' '\x00\x00\x00\x00' \
2000
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
2001
-            '\x00\x00\x00\x01' '\x00\x00\x00\x02' \
2002
-            '\x00\x00\x00\x03'
2003
+        self.reply_bin_7 = b'\x01\x20\x90\xe6' b'\x00\x00\x00\x03' \
2004
+            b'\x29\xfb\xbc\x69' b'\x74\xab\xb1\x1f' \
2005
+            b'\x00\x00\x00\x03' b'\x00\x00\x00\x00' \
2006
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
2007
+            b'\x00\x00\x00\x01' b'\x00\x00\x00\x02' \
2008
+            b'\x00\x00\x00\x03'
2009
 
2010
 
2011
     def testPackRequest0(self):
2012
-        bin = apply(request.GetProperty._request.to_binary, (), self.req_args_0)
2013
+        bin = request.GetProperty._request.to_binary(*(), **self.req_args_0)
2014
         try:
2015
             assert bin == self.req_bin_0
2016
         except AssertionError:
2017
@@ -1126,7 +1134,7 @@
2018
             raise AssertionError(args)
2019
 
2020
     def testPackReply0(self):
2021
-        bin = apply(request.GetProperty._reply.to_binary, (), self.reply_args_0)
2022
+        bin = request.GetProperty._reply.to_binary(*(), **self.reply_args_0)
2023
         try:
2024
             assert bin == self.reply_bin_0
2025
         except AssertionError:
2026
@@ -1144,7 +1152,7 @@
2027
             raise AssertionError(args)
2028
 
2029
     def testPackReply1(self):
2030
-        bin = apply(request.GetProperty._reply.to_binary, (), self.reply_args_1)
2031
+        bin = request.GetProperty._reply.to_binary(*(), **self.reply_args_1)
2032
         try:
2033
             assert bin == self.reply_bin_1
2034
         except AssertionError:
2035
@@ -1162,7 +1170,7 @@
2036
             raise AssertionError(args)
2037
 
2038
     def testPackReply2(self):
2039
-        bin = apply(request.GetProperty._reply.to_binary, (), self.reply_args_2)
2040
+        bin = request.GetProperty._reply.to_binary(*(), **self.reply_args_2)
2041
         try:
2042
             assert bin == self.reply_bin_2
2043
         except AssertionError:
2044
@@ -1180,7 +1188,7 @@
2045
             raise AssertionError(args)
2046
 
2047
     def testPackReply3(self):
2048
-        bin = apply(request.GetProperty._reply.to_binary, (), self.reply_args_3)
2049
+        bin = request.GetProperty._reply.to_binary(*(), **self.reply_args_3)
2050
         try:
2051
             assert bin == self.reply_bin_3
2052
         except AssertionError:
2053
@@ -1198,7 +1206,7 @@
2054
             raise AssertionError(args)
2055
 
2056
     def testPackReply4(self):
2057
-        bin = apply(request.GetProperty._reply.to_binary, (), self.reply_args_4)
2058
+        bin = request.GetProperty._reply.to_binary(*(), **self.reply_args_4)
2059
         try:
2060
             assert bin == self.reply_bin_4
2061
         except AssertionError:
2062
@@ -1216,7 +1224,7 @@
2063
             raise AssertionError(args)
2064
 
2065
     def testPackReply5(self):
2066
-        bin = apply(request.GetProperty._reply.to_binary, (), self.reply_args_5)
2067
+        bin = request.GetProperty._reply.to_binary(*(), **self.reply_args_5)
2068
         try:
2069
             assert bin == self.reply_bin_5
2070
         except AssertionError:
2071
@@ -1234,7 +1242,7 @@
2072
             raise AssertionError(args)
2073
 
2074
     def testPackReply6(self):
2075
-        bin = apply(request.GetProperty._reply.to_binary, (), self.reply_args_6)
2076
+        bin = request.GetProperty._reply.to_binary(*(), **self.reply_args_6)
2077
         try:
2078
             assert bin == self.reply_bin_6
2079
         except AssertionError:
2080
@@ -1252,7 +1260,7 @@
2081
             raise AssertionError(args)
2082
 
2083
     def testPackReply7(self):
2084
-        bin = apply(request.GetProperty._reply.to_binary, (), self.reply_args_7)
2085
+        bin = request.GetProperty._reply.to_binary(*(), **self.reply_args_7)
2086
         try:
2087
             assert bin == self.reply_bin_7
2088
         except AssertionError:
2089
@@ -1275,32 +1283,32 @@
2090
         self.req_args_0 = {
2091
             'window': 91262675,
2092
             }
2093
-        self.req_bin_0 = '\x15\x00\x00\x02' '\x05\x70\x8e\xd3'
2094
+        self.req_bin_0 = b'\x15\x00\x00\x02' b'\x05\x70\x8e\xd3'
2095
 
2096
         self.reply_args_0 = {
2097
             'atoms': [580972634, 926488735, 714741529, 408777797, 679906858, 705092899, 2063243279, 893967755, 1591182471, 571137996, 1677110101, 1783836762, 1678219148, 1992402577, 871298793, 1182885899, 1155013854, 1822076326, 2117552706, 1972668469, 1660227078, 1523268962, 694042433],
2098
             'sequence_number': 42191,
2099
             }
2100
-        self.reply_bin_0 = '\x01\x00\xa4\xcf' '\x00\x00\x00\x17' \
2101
-            '\x00\x17\x00\x00' '\x00\x00\x00\x00' \
2102
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
2103
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
2104
-            '\x22\xa0\xf0\x5a' '\x37\x39\x18\x9f' \
2105
-            '\x2a\x9a\x17\x19' '\x18\x5d\x74\x45' \
2106
-            '\x28\x86\x8e\x2a' '\x2a\x06\xdd\x23' \
2107
-            '\x7a\xfa\x98\x0f' '\x35\x48\xdd\x8b' \
2108
-            '\x5e\xd7\x84\x87' '\x22\x0a\xdf\xcc' \
2109
-            '\x63\xf6\xab\x55' '\x6a\x53\x30\x5a' \
2110
-            '\x64\x07\x97\x8c' '\x76\xc1\xa6\x91' \
2111
-            '\x33\xee\xf6\xe9' '\x46\x81\x68\x0b' \
2112
-            '\x44\xd8\x1c\xde' '\x6c\x9a\xad\xa6' \
2113
-            '\x7e\x37\x4a\x42' '\x75\x94\x88\x35' \
2114
-            '\x62\xf5\x0e\x06' '\x5a\xcb\x3d\x62' \
2115
-            '\x29\x5e\x3f\x41'
2116
+        self.reply_bin_0 = b'\x01\x00\xa4\xcf' b'\x00\x00\x00\x17' \
2117
+            b'\x00\x17\x00\x00' b'\x00\x00\x00\x00' \
2118
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
2119
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
2120
+            b'\x22\xa0\xf0\x5a' b'\x37\x39\x18\x9f' \
2121
+            b'\x2a\x9a\x17\x19' b'\x18\x5d\x74\x45' \
2122
+            b'\x28\x86\x8e\x2a' b'\x2a\x06\xdd\x23' \
2123
+            b'\x7a\xfa\x98\x0f' b'\x35\x48\xdd\x8b' \
2124
+            b'\x5e\xd7\x84\x87' b'\x22\x0a\xdf\xcc' \
2125
+            b'\x63\xf6\xab\x55' b'\x6a\x53\x30\x5a' \
2126
+            b'\x64\x07\x97\x8c' b'\x76\xc1\xa6\x91' \
2127
+            b'\x33\xee\xf6\xe9' b'\x46\x81\x68\x0b' \
2128
+            b'\x44\xd8\x1c\xde' b'\x6c\x9a\xad\xa6' \
2129
+            b'\x7e\x37\x4a\x42' b'\x75\x94\x88\x35' \
2130
+            b'\x62\xf5\x0e\x06' b'\x5a\xcb\x3d\x62' \
2131
+            b'\x29\x5e\x3f\x41'
2132
 
2133
 
2134
     def testPackRequest0(self):
2135
-        bin = apply(request.ListProperties._request.to_binary, (), self.req_args_0)
2136
+        bin = request.ListProperties._request.to_binary(*(), **self.req_args_0)
2137
         try:
2138
             assert bin == self.req_bin_0
2139
         except AssertionError:
2140
@@ -1318,7 +1326,7 @@
2141
             raise AssertionError(args)
2142
 
2143
     def testPackReply0(self):
2144
-        bin = apply(request.ListProperties._reply.to_binary, (), self.reply_args_0)
2145
+        bin = request.ListProperties._reply.to_binary(*(), **self.reply_args_0)
2146
         try:
2147
             assert bin == self.reply_bin_0
2148
         except AssertionError:
2149
@@ -1343,12 +1351,12 @@
2150
             'window': 1190911777,
2151
             'time': 1606660593,
2152
             }
2153
-        self.req_bin_0 = '\x16\x00\x00\x04' '\x46\xfb\xdf\x21' \
2154
-            '\x7b\x74\xe4\x1b' '\x5f\xc3\xb1\xf1'
2155
+        self.req_bin_0 = b'\x16\x00\x00\x04' b'\x46\xfb\xdf\x21' \
2156
+            b'\x7b\x74\xe4\x1b' b'\x5f\xc3\xb1\xf1'
2157
 
2158
 
2159
     def testPackRequest0(self):
2160
-        bin = apply(request.SetSelectionOwner._request.to_binary, (), self.req_args_0)
2161
+        bin = request.SetSelectionOwner._request.to_binary(*(), **self.req_args_0)
2162
         try:
2163
             assert bin == self.req_bin_0
2164
         except AssertionError:
2165
@@ -1371,20 +1379,20 @@
2166
         self.req_args_0 = {
2167
             'selection': 819576555,
2168
             }
2169
-        self.req_bin_0 = '\x17\x00\x00\x02' '\x30\xd9\xbe\xeb'
2170
+        self.req_bin_0 = b'\x17\x00\x00\x02' b'\x30\xd9\xbe\xeb'
2171
 
2172
         self.reply_args_0 = {
2173
             'sequence_number': 14152,
2174
             'owner': 1922331178,
2175
             }
2176
-        self.reply_bin_0 = '\x01\x00\x37\x48' '\x00\x00\x00\x00' \
2177
-            '\x72\x94\x72\x2a' '\x00\x00\x00\x00' \
2178
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
2179
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
2180
+        self.reply_bin_0 = b'\x01\x00\x37\x48' b'\x00\x00\x00\x00' \
2181
+            b'\x72\x94\x72\x2a' b'\x00\x00\x00\x00' \
2182
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
2183
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
2184
 
2185
 
2186
     def testPackRequest0(self):
2187
-        bin = apply(request.GetSelectionOwner._request.to_binary, (), self.req_args_0)
2188
+        bin = request.GetSelectionOwner._request.to_binary(*(), **self.req_args_0)
2189
         try:
2190
             assert bin == self.req_bin_0
2191
         except AssertionError:
2192
@@ -1402,7 +1410,7 @@
2193
             raise AssertionError(args)
2194
 
2195
     def testPackReply0(self):
2196
-        bin = apply(request.GetSelectionOwner._reply.to_binary, (), self.reply_args_0)
2197
+        bin = request.GetSelectionOwner._reply.to_binary(*(), **self.reply_args_0)
2198
         try:
2199
             assert bin == self.reply_bin_0
2200
         except AssertionError:
2201
@@ -1429,13 +1437,13 @@
2202
             'selection': 125139929,
2203
             'requestor': 300355135,
2204
             }
2205
-        self.req_bin_0 = '\x18\x00\x00\x06' '\x11\xe7\x0e\x3f' \
2206
-            '\x07\x75\x7b\xd9' '\x75\x8e\x82\x08' \
2207
-            '\x7f\x6c\x1d\xb7' '\x5f\x0c\x79\xd6'
2208
+        self.req_bin_0 = b'\x18\x00\x00\x06' b'\x11\xe7\x0e\x3f' \
2209
+            b'\x07\x75\x7b\xd9' b'\x75\x8e\x82\x08' \
2210
+            b'\x7f\x6c\x1d\xb7' b'\x5f\x0c\x79\xd6'
2211
 
2212
 
2213
     def testPackRequest0(self):
2214
-        bin = apply(request.ConvertSelection._request.to_binary, (), self.req_args_0)
2215
+        bin = request.ConvertSelection._request.to_binary(*(), **self.req_args_0)
2216
         try:
2217
             assert bin == self.req_bin_0
2218
         except AssertionError:
2219
@@ -1461,16 +1469,16 @@
2220
             'destination': 1369243800,
2221
             'event_mask': 1594482936,
2222
             }
2223
-        self.req_bin_0 = '\x19\x01\x00\x0b' '\x51\x9d\x00\x98' \
2224
-            '\x5f\x09\xe0\xf8' '\x0c\x00\x00\x00' \
2225
-            '\x4e\xce\xfa\x94' '\xcd\x42\xdb\xfc' \
2226
-            '\x40\xe4\xfd\x10' '\x37\x54\x00\x00' \
2227
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
2228
-            '\x00\x00\x00\x00'
2229
+        self.req_bin_0 = b'\x19\x01\x00\x0b' b'\x51\x9d\x00\x98' \
2230
+            b'\x5f\x09\xe0\xf8' b'\x0c\x00\x00\x00' \
2231
+            b'\x4e\xce\xfa\x94' b'\xcd\x42\xdb\xfc' \
2232
+            b'\x40\xe4\xfd\x10' b'\x37\x54\x00\x00' \
2233
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
2234
+            b'\x00\x00\x00\x00'
2235
 
2236
 
2237
     def testPackRequest0(self):
2238
-        bin = apply(request.SendEvent._request.to_binary, (), self.req_args_0)
2239
+        bin = request.SendEvent._request.to_binary(*(), **self.req_args_0)
2240
         try:
2241
             assert bin == self.req_bin_0
2242
         except AssertionError:
2243
@@ -1500,22 +1508,22 @@
2244
             'keyboard_mode': 1,
2245
             'cursor': 17101598,
2246
             }
2247
-        self.req_bin_0 = '\x1a\x01\x00\x06' '\x7d\x75\x91\xbc' \
2248
-            '\x08\x1b\x00\x01' '\x76\x82\xb9\x57' \
2249
-            '\x01\x04\xf3\x1e' '\x4e\x77\x17\xcc'
2250
+        self.req_bin_0 = b'\x1a\x01\x00\x06' b'\x7d\x75\x91\xbc' \
2251
+            b'\x08\x1b\x00\x01' b'\x76\x82\xb9\x57' \
2252
+            b'\x01\x04\xf3\x1e' b'\x4e\x77\x17\xcc'
2253
 
2254
         self.reply_args_0 = {
2255
             'sequence_number': 47539,
2256
             'status': 149,
2257
             }
2258
-        self.reply_bin_0 = '\x01\x95\xb9\xb3' '\x00\x00\x00\x00' \
2259
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
2260
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
2261
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
2262
+        self.reply_bin_0 = b'\x01\x95\xb9\xb3' b'\x00\x00\x00\x00' \
2263
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
2264
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
2265
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
2266
 
2267
 
2268
     def testPackRequest0(self):
2269
-        bin = apply(request.GrabPointer._request.to_binary, (), self.req_args_0)
2270
+        bin = request.GrabPointer._request.to_binary(*(), **self.req_args_0)
2271
         try:
2272
             assert bin == self.req_bin_0
2273
         except AssertionError:
2274
@@ -1533,7 +1541,7 @@
2275
             raise AssertionError(args)
2276
 
2277
     def testPackReply0(self):
2278
-        bin = apply(request.GrabPointer._reply.to_binary, (), self.reply_args_0)
2279
+        bin = request.GrabPointer._reply.to_binary(*(), **self.reply_args_0)
2280
         try:
2281
             assert bin == self.reply_bin_0
2282
         except AssertionError:
2283
@@ -1556,11 +1564,11 @@
2284
         self.req_args_0 = {
2285
             'time': 209008422,
2286
             }
2287
-        self.req_bin_0 = '\x1b\x00\x00\x02' '\x0c\x75\x37\x26'
2288
+        self.req_bin_0 = b'\x1b\x00\x00\x02' b'\x0c\x75\x37\x26'
2289
 
2290
 
2291
     def testPackRequest0(self):
2292
-        bin = apply(request.UngrabPointer._request.to_binary, (), self.req_args_0)
2293
+        bin = request.UngrabPointer._request.to_binary(*(), **self.req_args_0)
2294
         try:
2295
             assert bin == self.req_bin_0
2296
         except AssertionError:
2297
@@ -1591,13 +1599,13 @@
2298
             'keyboard_mode': 1,
2299
             'cursor': 1070323643,
2300
             }
2301
-        self.req_bin_0 = '\x1c\x01\x00\x06' '\x1f\x60\x42\x88' \
2302
-            '\x3f\x97\x01\x01' '\x6d\xe8\x6c\x5b' \
2303
-            '\x3f\xcb\xd7\xbb' '\xd0\x00\x3c\xe5'
2304
+        self.req_bin_0 = b'\x1c\x01\x00\x06' b'\x1f\x60\x42\x88' \
2305
+            b'\x3f\x97\x01\x01' b'\x6d\xe8\x6c\x5b' \
2306
+            b'\x3f\xcb\xd7\xbb' b'\xd0\x00\x3c\xe5'
2307
 
2308
 
2309
     def testPackRequest0(self):
2310
-        bin = apply(request.GrabButton._request.to_binary, (), self.req_args_0)
2311
+        bin = request.GrabButton._request.to_binary(*(), **self.req_args_0)
2312
         try:
2313
             assert bin == self.req_bin_0
2314
         except AssertionError:
2315
@@ -1622,12 +1630,12 @@
2316
             'button': 240,
2317
             'modifiers': 51717,
2318
             }
2319
-        self.req_bin_0 = '\x1d\xf0\x00\x03' '\x2f\x69\x0e\x86' \
2320
-            '\xca\x05\x00\x00'
2321
+        self.req_bin_0 = b'\x1d\xf0\x00\x03' b'\x2f\x69\x0e\x86' \
2322
+            b'\xca\x05\x00\x00'
2323
 
2324
 
2325
     def testPackRequest0(self):
2326
-        bin = apply(request.UngrabButton._request.to_binary, (), self.req_args_0)
2327
+        bin = request.UngrabButton._request.to_binary(*(), **self.req_args_0)
2328
         try:
2329
             assert bin == self.req_bin_0
2330
         except AssertionError:
2331
@@ -1652,12 +1660,12 @@
2332
             'event_mask': 23423,
2333
             'cursor': 1696594928,
2334
             }
2335
-        self.req_bin_0 = '\x1e\x00\x00\x04' '\x65\x1f\xfb\xf0' \
2336
-            '\x35\x20\xbb\x64' '\x5b\x7f\x00\x00'
2337
+        self.req_bin_0 = b'\x1e\x00\x00\x04' b'\x65\x1f\xfb\xf0' \
2338
+            b'\x35\x20\xbb\x64' b'\x5b\x7f\x00\x00'
2339
 
2340
 
2341
     def testPackRequest0(self):
2342
-        bin = apply(request.ChangeActivePointerGrab._request.to_binary, (), self.req_args_0)
2343
+        bin = request.ChangeActivePointerGrab._request.to_binary(*(), **self.req_args_0)
2344
         try:
2345
             assert bin == self.req_bin_0
2346
         except AssertionError:
2347
@@ -1684,21 +1692,21 @@
2348
             'pointer_mode': 1,
2349
             'keyboard_mode': 1,
2350
             }
2351
-        self.req_bin_0 = '\x1f\x00\x00\x04' '\x04\x89\xaf\x67' \
2352
-            '\x5d\x23\x78\xd9' '\x01\x01\x00\x00'
2353
+        self.req_bin_0 = b'\x1f\x00\x00\x04' b'\x04\x89\xaf\x67' \
2354
+            b'\x5d\x23\x78\xd9' b'\x01\x01\x00\x00'
2355
 
2356
         self.reply_args_0 = {
2357
             'sequence_number': 9648,
2358
             'status': 129,
2359
             }
2360
-        self.reply_bin_0 = '\x01\x81\x25\xb0' '\x00\x00\x00\x00' \
2361
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
2362
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
2363
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
2364
+        self.reply_bin_0 = b'\x01\x81\x25\xb0' b'\x00\x00\x00\x00' \
2365
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
2366
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
2367
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
2368
 
2369
 
2370
     def testPackRequest0(self):
2371
-        bin = apply(request.GrabKeyboard._request.to_binary, (), self.req_args_0)
2372
+        bin = request.GrabKeyboard._request.to_binary(*(), **self.req_args_0)
2373
         try:
2374
             assert bin == self.req_bin_0
2375
         except AssertionError:
2376
@@ -1716,7 +1724,7 @@
2377
             raise AssertionError(args)
2378
 
2379
     def testPackReply0(self):
2380
-        bin = apply(request.GrabKeyboard._reply.to_binary, (), self.reply_args_0)
2381
+        bin = request.GrabKeyboard._reply.to_binary(*(), **self.reply_args_0)
2382
         try:
2383
             assert bin == self.reply_bin_0
2384
         except AssertionError:
2385
@@ -1739,11 +1747,11 @@
2386
         self.req_args_0 = {
2387
             'time': 1352311886,
2388
             }
2389
-        self.req_bin_0 = '\x20\x00\x00\x02' '\x50\x9a\xa4\x4e'
2390
+        self.req_bin_0 = b'\x20\x00\x00\x02' b'\x50\x9a\xa4\x4e'
2391
 
2392
 
2393
     def testPackRequest0(self):
2394
-        bin = apply(request.UngrabKeyboard._request.to_binary, (), self.req_args_0)
2395
+        bin = request.UngrabKeyboard._request.to_binary(*(), **self.req_args_0)
2396
         try:
2397
             assert bin == self.req_bin_0
2398
         except AssertionError:
2399
@@ -1771,12 +1779,12 @@
2400
             'modifiers': 28819,
2401
             'key': 193,
2402
             }
2403
-        self.req_bin_0 = '\x21\x01\x00\x04' '\x57\x78\x21\xf0' \
2404
-            '\x70\x93\xc1\x00' '\x00\x00\x00\x00'
2405
+        self.req_bin_0 = b'\x21\x01\x00\x04' b'\x57\x78\x21\xf0' \
2406
+            b'\x70\x93\xc1\x00' b'\x00\x00\x00\x00'
2407
 
2408
 
2409
     def testPackRequest0(self):
2410
-        bin = apply(request.GrabKey._request.to_binary, (), self.req_args_0)
2411
+        bin = request.GrabKey._request.to_binary(*(), **self.req_args_0)
2412
         try:
2413
             assert bin == self.req_bin_0
2414
         except AssertionError:
2415
@@ -1801,12 +1809,12 @@
2416
             'key': 215,
2417
             'modifiers': 60588,
2418
             }
2419
-        self.req_bin_0 = '\x22\xd7\x00\x03' '\x2d\xe4\x31\xbb' \
2420
-            '\xec\xac\x00\x00'
2421
+        self.req_bin_0 = b'\x22\xd7\x00\x03' b'\x2d\xe4\x31\xbb' \
2422
+            b'\xec\xac\x00\x00'
2423
 
2424
 
2425
     def testPackRequest0(self):
2426
-        bin = apply(request.UngrabKey._request.to_binary, (), self.req_args_0)
2427
+        bin = request.UngrabKey._request.to_binary(*(), **self.req_args_0)
2428
         try:
2429
             assert bin == self.req_bin_0
2430
         except AssertionError:
2431
@@ -1830,11 +1838,11 @@
2432
             'time': 342147129,
2433
             'mode': 1,
2434
             }
2435
-        self.req_bin_0 = '\x23\x01\x00\x02' '\x14\x64\xc0\x39'
2436
+        self.req_bin_0 = b'\x23\x01\x00\x02' b'\x14\x64\xc0\x39'
2437
 
2438
 
2439
     def testPackRequest0(self):
2440
-        bin = apply(request.AllowEvents._request.to_binary, (), self.req_args_0)
2441
+        bin = request.AllowEvents._request.to_binary(*(), **self.req_args_0)
2442
         try:
2443
             assert bin == self.req_bin_0
2444
         except AssertionError:
2445
@@ -1856,11 +1864,11 @@
2446
     def setUp(self):
2447
         self.req_args_0 = {
2448
             }
2449
-        self.req_bin_0 = '\x24\x00\x00\x01'
2450
+        self.req_bin_0 = b'\x24\x00\x00\x01'
2451
 
2452
 
2453
     def testPackRequest0(self):
2454
-        bin = apply(request.GrabServer._request.to_binary, (), self.req_args_0)
2455
+        bin = request.GrabServer._request.to_binary(*(), **self.req_args_0)
2456
         try:
2457
             assert bin == self.req_bin_0
2458
         except AssertionError:
2459
@@ -1882,11 +1890,11 @@
2460
     def setUp(self):
2461
         self.req_args_0 = {
2462
             }
2463
-        self.req_bin_0 = '\x25\x00\x00\x01'
2464
+        self.req_bin_0 = b'\x25\x00\x00\x01'
2465
 
2466
 
2467
     def testPackRequest0(self):
2468
-        bin = apply(request.UngrabServer._request.to_binary, (), self.req_args_0)
2469
+        bin = request.UngrabServer._request.to_binary(*(), **self.req_args_0)
2470
         try:
2471
             assert bin == self.req_bin_0
2472
         except AssertionError:
2473
@@ -1909,7 +1917,7 @@
2474
         self.req_args_0 = {
2475
             'window': 561336799,
2476
             }
2477
-        self.req_bin_0 = '\x26\x00\x00\x02' '\x21\x75\x51\xdf'
2478
+        self.req_bin_0 = b'\x26\x00\x00\x02' b'\x21\x75\x51\xdf'
2479
 
2480
         self.reply_args_0 = {
2481
             'win_y': -25733,
2482
@@ -1922,14 +1930,14 @@
2483
             'child': 1075058918,
2484
             'win_x': -18858,
2485
             }
2486
-        self.reply_bin_0 = '\x01\x00\xa1\xe8' '\x00\x00\x00\x00' \
2487
-            '\x5f\x52\x73\x56' '\x40\x14\x18\xe6' \
2488
-            '\xef\xa7\xe8\x20' '\xb6\x56\x9b\x7b' \
2489
-            '\x8c\x73\x00\x00' '\x00\x00\x00\x00'
2490
+        self.reply_bin_0 = b'\x01\x00\xa1\xe8' b'\x00\x00\x00\x00' \
2491
+            b'\x5f\x52\x73\x56' b'\x40\x14\x18\xe6' \
2492
+            b'\xef\xa7\xe8\x20' b'\xb6\x56\x9b\x7b' \
2493
+            b'\x8c\x73\x00\x00' b'\x00\x00\x00\x00'
2494
 
2495
 
2496
     def testPackRequest0(self):
2497
-        bin = apply(request.QueryPointer._request.to_binary, (), self.req_args_0)
2498
+        bin = request.QueryPointer._request.to_binary(*(), **self.req_args_0)
2499
         try:
2500
             assert bin == self.req_bin_0
2501
         except AssertionError:
2502
@@ -1947,7 +1955,7 @@
2503
             raise AssertionError(args)
2504
 
2505
     def testPackReply0(self):
2506
-        bin = apply(request.QueryPointer._reply.to_binary, (), self.reply_args_0)
2507
+        bin = request.QueryPointer._reply.to_binary(*(), **self.reply_args_0)
2508
         try:
2509
             assert bin == self.reply_bin_0
2510
         except AssertionError:
2511
@@ -1972,26 +1980,26 @@
2512
             'start': 1520150500,
2513
             'stop': 11115313,
2514
             }
2515
-        self.req_bin_0 = '\x27\x00\x00\x04' '\x32\x49\x8f\xf4' \
2516
-            '\x5a\x9b\xa7\xe4' '\x00\xa9\x9b\x31'
2517
+        self.req_bin_0 = b'\x27\x00\x00\x04' b'\x32\x49\x8f\xf4' \
2518
+            b'\x5a\x9b\xa7\xe4' b'\x00\xa9\x9b\x31'
2519
 
2520
         self.reply_args_0 = {
2521
             'sequence_number': 52222,
2522
             'events': [{'time': 2107444516, 'x': -649, 'y': -11631}, {'time': 1827536960, 'x': -18061, 'y': -2301}, {'time': 554175146, 'x': -32111, 'y': -13522}, {'time': 608168588, 'x': -5963, 'y': -24618}, {'time': 590416221, 'x': -3325, 'y': -19656}],
2523
             }
2524
-        self.reply_bin_0 = '\x01\x00\xcb\xfe' '\x00\x00\x00\x0a' \
2525
-            '\x00\x00\x00\x05' '\x00\x00\x00\x00' \
2526
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
2527
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
2528
-            '\x7d\x9d\x0d\x24' '\xfd\x77\xd2\x91' \
2529
-            '\x6c\xee\x00\x40' '\xb9\x73\xf7\x03' \
2530
-            '\x21\x08\x0a\xaa' '\x82\x91\xcb\x2e' \
2531
-            '\x24\x3f\xea\x8c' '\xe8\xb5\x9f\xd6' \
2532
-            '\x23\x31\x09\x5d' '\xf3\x03\xb3\x38'
2533
+        self.reply_bin_0 = b'\x01\x00\xcb\xfe' b'\x00\x00\x00\x0a' \
2534
+            b'\x00\x00\x00\x05' b'\x00\x00\x00\x00' \
2535
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
2536
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
2537
+            b'\x7d\x9d\x0d\x24' b'\xfd\x77\xd2\x91' \
2538
+            b'\x6c\xee\x00\x40' b'\xb9\x73\xf7\x03' \
2539
+            b'\x21\x08\x0a\xaa' b'\x82\x91\xcb\x2e' \
2540
+            b'\x24\x3f\xea\x8c' b'\xe8\xb5\x9f\xd6' \
2541
+            b'\x23\x31\x09\x5d' b'\xf3\x03\xb3\x38'
2542
 
2543
 
2544
     def testPackRequest0(self):
2545
-        bin = apply(request.GetMotionEvents._request.to_binary, (), self.req_args_0)
2546
+        bin = request.GetMotionEvents._request.to_binary(*(), **self.req_args_0)
2547
         try:
2548
             assert bin == self.req_bin_0
2549
         except AssertionError:
2550
@@ -2009,7 +2017,7 @@
2551
             raise AssertionError(args)
2552
 
2553
     def testPackReply0(self):
2554
-        bin = apply(request.GetMotionEvents._reply.to_binary, (), self.reply_args_0)
2555
+        bin = request.GetMotionEvents._reply.to_binary(*(), **self.reply_args_0)
2556
         try:
2557
             assert bin == self.reply_bin_0
2558
         except AssertionError:
2559
@@ -2035,8 +2043,8 @@
2560
             'src_wid': 257619448,
2561
             'dst_wid': 1238981863,
2562
             }
2563
-        self.req_bin_0 = '\x28\x00\x00\x04' '\x0f\x5a\xf5\xf8' \
2564
-            '\x49\xd9\x5c\xe7' '\x9d\x0d\x95\x91'
2565
+        self.req_bin_0 = b'\x28\x00\x00\x04' b'\x0f\x5a\xf5\xf8' \
2566
+            b'\x49\xd9\x5c\xe7' b'\x9d\x0d\x95\x91'
2567
 
2568
         self.reply_args_0 = {
2569
             'child': 2050350678,
2570
@@ -2045,14 +2053,14 @@
2571
             'x': -18096,
2572
             'y': -5252,
2573
             }
2574
-        self.reply_bin_0 = '\x01\x01\x97\x01' '\x00\x00\x00\x00' \
2575
-            '\x7a\x35\xde\x56' '\xb9\x50\xeb\x7c' \
2576
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
2577
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
2578
+        self.reply_bin_0 = b'\x01\x01\x97\x01' b'\x00\x00\x00\x00' \
2579
+            b'\x7a\x35\xde\x56' b'\xb9\x50\xeb\x7c' \
2580
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
2581
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
2582
 
2583
 
2584
     def testPackRequest0(self):
2585
-        bin = apply(request.TranslateCoords._request.to_binary, (), self.req_args_0)
2586
+        bin = request.TranslateCoords._request.to_binary(*(), **self.req_args_0)
2587
         try:
2588
             assert bin == self.req_bin_0
2589
         except AssertionError:
2590
@@ -2070,7 +2078,7 @@
2591
             raise AssertionError(args)
2592
 
2593
     def testPackReply0(self):
2594
-        bin = apply(request.TranslateCoords._reply.to_binary, (), self.reply_args_0)
2595
+        bin = request.TranslateCoords._reply.to_binary(*(), **self.reply_args_0)
2596
         try:
2597
             assert bin == self.reply_bin_0
2598
         except AssertionError:
2599
@@ -2100,13 +2108,13 @@
2600
             'dst_x': -30516,
2601
             'dst_y': -24204,
2602
             }
2603
-        self.req_bin_0 = '\x29\x00\x00\x06' '\x4f\x93\xba\xef' \
2604
-            '\x28\x44\x07\xf4' '\x96\x11\x9a\x29' \
2605
-            '\x55\x31\xdd\x3a' '\x88\xcc\xa1\x74'
2606
+        self.req_bin_0 = b'\x29\x00\x00\x06' b'\x4f\x93\xba\xef' \
2607
+            b'\x28\x44\x07\xf4' b'\x96\x11\x9a\x29' \
2608
+            b'\x55\x31\xdd\x3a' b'\x88\xcc\xa1\x74'
2609
 
2610
 
2611
     def testPackRequest0(self):
2612
-        bin = apply(request.WarpPointer._request.to_binary, (), self.req_args_0)
2613
+        bin = request.WarpPointer._request.to_binary(*(), **self.req_args_0)
2614
         try:
2615
             assert bin == self.req_bin_0
2616
         except AssertionError:
2617
@@ -2131,12 +2139,12 @@
2618
             'time': 1079702500,
2619
             'focus': 1026400247,
2620
             }
2621
-        self.req_bin_0 = '\x2a\x01\x00\x03' '\x3d\x2d\x9f\xf7' \
2622
-            '\x40\x5a\xf3\xe4'
2623
+        self.req_bin_0 = b'\x2a\x01\x00\x03' b'\x3d\x2d\x9f\xf7' \
2624
+            b'\x40\x5a\xf3\xe4'
2625
 
2626
 
2627
     def testPackRequest0(self):
2628
-        bin = apply(request.SetInputFocus._request.to_binary, (), self.req_args_0)
2629
+        bin = request.SetInputFocus._request.to_binary(*(), **self.req_args_0)
2630
         try:
2631
             assert bin == self.req_bin_0
2632
         except AssertionError:
2633
@@ -2158,21 +2166,21 @@
2634
     def setUp(self):
2635
         self.req_args_0 = {
2636
             }
2637
-        self.req_bin_0 = '\x2b\x00\x00\x01'
2638
+        self.req_bin_0 = b'\x2b\x00\x00\x01'
2639
 
2640
         self.reply_args_0 = {
2641
             'revert_to': 152,
2642
             'sequence_number': 16002,
2643
             'focus': 2024022965,
2644
             }
2645
-        self.reply_bin_0 = '\x01\x98\x3e\x82' '\x00\x00\x00\x00' \
2646
-            '\x78\xa4\x23\xb5' '\x00\x00\x00\x00' \
2647
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
2648
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00'
2649
+        self.reply_bin_0 = b'\x01\x98\x3e\x82' b'\x00\x00\x00\x00' \
2650
+            b'\x78\xa4\x23\xb5' b'\x00\x00\x00\x00' \
2651
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
2652
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00'
2653
 
2654
 
2655
     def testPackRequest0(self):
2656
-        bin = apply(request.GetInputFocus._request.to_binary, (), self.req_args_0)
2657
+        bin = request.GetInputFocus._request.to_binary(*(), **self.req_args_0)
2658
         try:
2659
             assert bin == self.req_bin_0
2660
         except AssertionError:
2661
@@ -2190,7 +2198,7 @@
2662
             raise AssertionError(args)
2663
 
2664
     def testPackReply0(self):
2665
-        bin = apply(request.GetInputFocus._reply.to_binary, (), self.reply_args_0)
2666
+        bin = request.GetInputFocus._reply.to_binary(*(), **self.reply_args_0)
2667
         try:
2668
             assert bin == self.reply_bin_0
2669
         except AssertionError:
2670
@@ -2212,21 +2220,21 @@
2671
     def setUp(self):
2672
         self.req_args_0 = {
2673
             }
2674
-        self.req_bin_0 = '\x2c\x00\x00\x01'
2675
+        self.req_bin_0 = b'\x2c\x00\x00\x01'
2676
 
2677
         self.reply_args_0 = {
2678
             'sequence_number': 16233,
2679
             'map': [186, 167, 191, 213, 241, 231, 234, 175, 154, 169, 132, 146, 215, 191, 196, 212, 158, 156, 177, 233, 220, 192, 130, 226, 181, 233, 238, 141, 129, 215, 245, 215],
2680
             }
2681
-        self.reply_bin_0 = '\x01\x00\x3f\x69' '\x00\x00\x00\x02' \
2682
-            '\xba\xa7\xbf\xd5' '\xf1\xe7\xea\xaf' \
2683
-            '\x9a\xa9\x84\x92' '\xd7\xbf\xc4\xd4' \
2684
-            '\x9e\x9c\xb1\xe9' '\xdc\xc0\x82\xe2' \
2685
-            '\xb5\xe9\xee\x8d' '\x81\xd7\xf5\xd7'
2686
+        self.reply_bin_0 = b'\x01\x00\x3f\x69' b'\x00\x00\x00\x02' \
2687
+            b'\xba\xa7\xbf\xd5' b'\xf1\xe7\xea\xaf' \
2688
+            b'\x9a\xa9\x84\x92' b'\xd7\xbf\xc4\xd4' \
2689
+            b'\x9e\x9c\xb1\xe9' b'\xdc\xc0\x82\xe2' \
2690
+            b'\xb5\xe9\xee\x8d' b'\x81\xd7\xf5\xd7'
2691
 
2692
 
2693
     def testPackRequest0(self):
2694
-        bin = apply(request.QueryKeymap._request.to_binary, (), self.req_args_0)
2695
+        bin = request.QueryKeymap._request.to_binary(*(), **self.req_args_0)
2696
         try:
2697
             assert bin == self.req_bin_0
2698
         except AssertionError:
2699
@@ -2244,7 +2252,7 @@
2700
             raise AssertionError(args)
2701
 
2702
     def testPackReply0(self):
2703
-        bin = apply(request.QueryKeymap._reply.to_binary, (), self.reply_args_0)
2704
+        bin = request.QueryKeymap._reply.to_binary(*(), **self.reply_args_0)
2705
         try:
2706
             assert bin == self.reply_bin_0
2707
         except AssertionError:
2708
@@ -2268,13 +2276,13 @@
2709
             'fid': 1728036313,
2710
             'name': 'foofont',
2711
             }
2712
-        self.req_bin_0 = '\x2d\x00\x00\x05' '\x66\xff\xbd\xd9' \
2713
-            '\x00\x07\x00\x00' '\x66\x6f\x6f\x66' \
2714
-            '\x6f\x6e\x74\x00'
2715
+        self.req_bin_0 = b'\x2d\x00\x00\x05' b'\x66\xff\xbd\xd9' \
2716
+            b'\x00\x07\x00\x00' b'\x66\x6f\x6f\x66' \
2717
+            b'\x6f\x6e\x74\x00'
2718
 
2719
 
2720
     def testPackRequest0(self):
2721
-        bin = apply(request.OpenFont._request.to_binary, (), self.req_args_0)
2722
+        bin = request.OpenFont._request.to_binary(*(), **self.req_args_0)
2723
         try:
2724
             assert bin == self.req_bin_0
2725
         except AssertionError:
2726
@@ -2297,11 +2305,11 @@
2727
         self.req_args_0 = {
2728
             'font': 1139770507,
2729
             }
2730
-        self.req_bin_0 = '\x2e\x00\x00\x02' '\x43\xef\x84\x8b'
2731
+        self.req_bin_0 = b'\x2e\x00\x00\x02' b'\x43\xef\x84\x8b'
2732
 
2733
 
2734
     def testPackRequest0(self):
2735
-        bin = apply(request.CloseFont._request.to_binary, (), self.req_args_0)
2736
+        bin = request.CloseFont._request.to_binary(*(), **self.req_args_0)
2737
         try:
2738
             assert bin == self.req_bin_0
2739
         except AssertionError:
2740
@@ -2324,7 +2332,7 @@
2741
         self.req_args_0 = {
2742
             'font': 1867659050,
2743
             }
2744
-        self.req_bin_0 = '\x2f\x00\x00\x02' '\x6f\x52\x37\x2a'
2745
+        self.req_bin_0 = b'\x2f\x00\x00\x02' b'\x6f\x52\x37\x2a'
2746
 
2747
         self.reply_args_0 = {
2748
             'sequence_number': 8877,
2749
@@ -2342,23 +2350,23 @@
2750
             'font_descent': -23067,
2751
             'max_bounds': {'descent': -24292, 'ascent': -26972, 'character_width': -19286, 'left_side_bearing': -16363, 'right_side_bearing': -3149, 'attributes': 35968},
2752
             }
2753
-        self.reply_bin_0 = '\x01\x00\x22\xad' '\x00\x00\x00\x12' \
2754
-            '\xae\xfc\xab\x3e' '\xeb\x5a\x96\x67' \
2755
-            '\x8b\x8b\x2c\x80' '\x00\x00\x00\x00' \
2756
-            '\xc0\x15\xf3\xb3' '\xb4\xaa\x96\xa4' \
2757
-            '\xa1\x1c\x8c\x80' '\x00\x00\x00\x00' \
2758
-            '\xc0\xd0\x09\xd4' '\x23\x22\x00\x01' \
2759
-            '\x8f\xbe\xa8\x01' '\xc2\xe2\xa5\xe5' \
2760
-            '\x00\x00\x00\x03' '\x56\x76\x30\xf3' \
2761
-            '\x7d\xc9\x5e\x19' '\xee\x57\xd9\x6d' \
2762
-            '\x90\x97\xc7\x8a' '\xfe\xb5\xd7\x97' \
2763
-            '\xb0\x53\x9d\x9d' '\xee\x4c\xe7\x7a' \
2764
-            '\xb6\xcd\x73\x24' '\xb1\x9c\xfc\x76' \
2765
-            '\xaa\xa1\xf6\xb6' '\xb8\x33\x86\x51'
2766
+        self.reply_bin_0 = b'\x01\x00\x22\xad' b'\x00\x00\x00\x12' \
2767
+            b'\xae\xfc\xab\x3e' b'\xeb\x5a\x96\x67' \
2768
+            b'\x8b\x8b\x2c\x80' b'\x00\x00\x00\x00' \
2769
+            b'\xc0\x15\xf3\xb3' b'\xb4\xaa\x96\xa4' \
2770
+            b'\xa1\x1c\x8c\x80' b'\x00\x00\x00\x00' \
2771
+            b'\xc0\xd0\x09\xd4' b'\x23\x22\x00\x01' \
2772
+            b'\x8f\xbe\xa8\x01' b'\xc2\xe2\xa5\xe5' \
2773
+            b'\x00\x00\x00\x03' b'\x56\x76\x30\xf3' \
2774
+            b'\x7d\xc9\x5e\x19' b'\xee\x57\xd9\x6d' \
2775
+            b'\x90\x97\xc7\x8a' b'\xfe\xb5\xd7\x97' \
2776
+            b'\xb0\x53\x9d\x9d' b'\xee\x4c\xe7\x7a' \
2777
+            b'\xb6\xcd\x73\x24' b'\xb1\x9c\xfc\x76' \
2778
+            b'\xaa\xa1\xf6\xb6' b'\xb8\x33\x86\x51'
2779
 
2780
 
2781
     def testPackRequest0(self):
2782
-        bin = apply(request.QueryFont._request.to_binary, (), self.req_args_0)
2783
+        bin = request.QueryFont._request.to_binary(*(), **self.req_args_0)
2784
         try:
2785
             assert bin == self.req_bin_0
2786
         except AssertionError:
2787
@@ -2376,7 +2384,7 @@
2788
             raise AssertionError(args)
2789
 
2790
     def testPackReply0(self):
2791
-        bin = apply(request.QueryFont._reply.to_binary, (), self.reply_args_0)
2792
+        bin = request.QueryFont._reply.to_binary(*(), **self.reply_args_0)
2793
         try:
2794
             assert bin == self.reply_bin_0
2795
         except AssertionError:
2796
@@ -2400,8 +2408,8 @@
2797
             'font': 1562125736,
2798
             'string': (102, 111, 111),
2799
             }
2800
-        self.req_bin_0 = '\x30\x01\x00\x04' '\x5d\x1c\x25\xa8' \
2801
-            '\x00\x66\x00\x6f' '\x00\x6f\x00\x00'
2802
+        self.req_bin_0 = b'\x30\x01\x00\x04' b'\x5d\x1c\x25\xa8' \
2803
+            b'\x00\x66\x00\x6f' b'\x00\x6f\x00\x00'
2804
 
2805
         self.reply_args_0 = {
2806
             'overall_width': -1378352414,
2807
@@ -2414,14 +2422,14 @@
2808
             'overall_left': -1046976699,
2809
             'font_descent': -14179,
2810
             }
2811
-        self.reply_bin_0 = '\x01\xdb\x1a\x87' '\x00\x00\x00\x00' \
2812
-            '\xbd\xed\xc8\x9d' '\xa6\x82\xf8\xfd' \
2813
-            '\xad\xd8\x02\xe2' '\xc1\x98\x67\x45' \
2814
-            '\xe0\x64\x80\xea' '\x00\x00\x00\x00'
2815
+        self.reply_bin_0 = b'\x01\xdb\x1a\x87' b'\x00\x00\x00\x00' \
2816
+            b'\xbd\xed\xc8\x9d' b'\xa6\x82\xf8\xfd' \
2817
+            b'\xad\xd8\x02\xe2' b'\xc1\x98\x67\x45' \
2818
+            b'\xe0\x64\x80\xea' b'\x00\x00\x00\x00'
2819
 
2820
 
2821
     def testPackRequest0(self):
2822
-        bin = apply(request.QueryTextExtents._request.to_binary, (), self.req_args_0)
2823
+        bin = request.QueryTextExtents._request.to_binary(*(), **self.req_args_0)
2824
         try:
2825
             assert bin == self.req_bin_0
2826
         except AssertionError:
2827
@@ -2439,7 +2447,7 @@
2828
             raise AssertionError(args)
2829
 
2830
     def testPackReply0(self):
2831
-        bin = apply(request.QueryTextExtents._reply.to_binary, (), self.reply_args_0)
2832
+        bin = request.QueryTextExtents._reply.to_binary(*(), **self.reply_args_0)
2833
         try:
2834
             assert bin == self.reply_bin_0
2835
         except AssertionError:
2836
@@ -2463,24 +2471,24 @@
2837
             'max_names': 53961,
2838
             'pattern': 'bhazr',
2839
             }
2840
-        self.req_bin_0 = '\x31\x00\x00\x04' '\xd2\xc9\x00\x05' \
2841
-            '\x62\x68\x61\x7a' '\x72\x00\x00\x00'
2842
+        self.req_bin_0 = b'\x31\x00\x00\x04' b'\xd2\xc9\x00\x05' \
2843
+            b'\x62\x68\x61\x7a' b'\x72\x00\x00\x00'
2844
 
2845
         self.reply_args_0 = {
2846
             'fonts': ['fie', 'fuzzy', 'foozooom'],
2847
             'sequence_number': 38267,
2848
             }
2849
-        self.reply_bin_0 = '\x01\x00\x95\x7b' '\x00\x00\x00\x05' \
2850
-            '\x00\x03\x00\x00' '\x00\x00\x00\x00' \
2851
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
2852
-            '\x00\x00\x00\x00' '\x00\x00\x00\x00' \
2853
-            '\x03\x66\x69\x65' '\x05\x66\x75\x7a' \
2854
-            '\x7a\x79\x08\x66' '\x6f\x6f\x7a\x6f' \
2855
-            '\x6f\x6f\x6d\x00'
2856
+        self.reply_bin_0 = b'\x01\x00\x95\x7b' b'\x00\x00\x00\x05' \
2857
+            b'\x00\x03\x00\x00' b'\x00\x00\x00\x00' \
2858
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
2859
+            b'\x00\x00\x00\x00' b'\x00\x00\x00\x00' \
2860
+            b'\x03\x66\x69\x65' b'\x05\x66\x75\x7a' \
2861
+            b'\x7a\x79\x08\x66' b'\x6f\x6f\x7a\x6f' \
2862
+            b'\x6f\x6f\x6d\x00'
2863
 
2864
 
2865
     def testPackRequest0(self):
2866
-        bin = apply(request.ListFonts._request.to_binary, (), self.req_args_0)
2867
+        bin = request.ListFonts._request.to_binary(*(), **self.req_args_0)
2868
         try:
2869
             assert bin == self.req_bin_0
2870
         except AssertionError:
2871
@@ -2498,7 +2506,7 @@
2872
             raise AssertionError(args)
2873
 
2874
     def testPackReply0(self):
2875
-        bin = apply(request.ListFonts._reply.to_binary, (), self.reply_args_0)
2876
+        bin = request.ListFonts._reply.to_binary(*(), **self.reply_args_0)
2877
         try:
2878
             assert bin == self.reply_bin_0
2879
         except AssertionError:
2880
@@ -2522,8 +2530,8 @@
2881
             'max_names': 46571,
2882
             'pattern': 'bhazr2',
2883
             }
2884
-        self.req_bin_0 = '\x32\x00\x00\x04' '\xb5\xeb\x00\x06' \
2885
-            '\x62\x68\x61\x7a' '\x72\x32\x00\x00'
2886
+        self.req_bin_0 = b'\x32\x00\x00\x04' b'\xb5\xeb\x00\x06' \
2887
+            b'\x62\x68\x61\x7a' b'\x72\x32\x00\x00'
2888
 
2889
         self.reply_args_0 = {
2890
             'sequence_number': 20014,
2891
@@ -2542,20 +2550,20 @@
2892
             'font_descent': -28978,
2893
             'max_bounds': {'descent': -20692, 'ascent': -6999, 'character_width': -15180, 'left_side_bearing': -7789, 'right_side_bearing': -5339, 'attributes': 1068},
2894
             }
2895
-        self.reply_bin_0 = '\x01\x08\x4e\x2e' '\x00\x00\x00\x0b' \
2896
-            '\x8b\xb9\x83\x5c' '\xcd\x1e\xc6\x49' \
2897
-            '\x93\x43\x09\xa1' '\x00\x00\x00\x00' \
2898
-            '\xe1\x93\xeb\x25' '\xc4\xb4\xe4\xa9' \
2899
-            '\xaf\x2c\x04\x2c' '\x00\x00\x00\x00' \
2900
-            '\x68\x0e\x09\xaf' '\x42\x91\x00\x01' \
2901
-            '\xc0\xd6\xd9\x00' '\x88\xaa\x8e\xce' \
2902
-            '\x76\x53\x9a\xa2' '\x19\xfc\x2b\xb0' \
2903
-            '\x7d\xca\x9c\xc9' '\x66\x6f\x6e\x74' \
2904
-            '\x66\x6f\x6e\x74'
2905
+        self.reply_bin_0 = b'\x01\x08\x4e\x2e' b'\x00\x00\x00\x0b' \
2906
+            b'\x8b\xb9\x83\x5c' b'\xcd\x1e\xc6\x49' \
2907
+            b'\x93\x43\x09\xa1' b'\x00\x00\x00\x00' \
2908
+            b'\xe1\x93\xeb\x25' b'\xc4\xb4\xe4\xa9' \
2909
+            b'\xaf\x2c\x04\x2c' b'\x00\x00\x00\x00' \
2910
+            b'\x68\x0e\x09\xaf' b'\x42\x91\x00\x01' \
2911
+            b'\xc0\xd6\xd9\x00' b'\x88\xaa\x8e\xce' \
2912
+            b'\x76\x53\x9a\xa2' b'\x19\xfc\x2b\xb0' \
2913
+            b'\x7d\xca\x9c\xc9' b'\x66\x6f\x6e\x74' \
2914
+            b'\x66\x6f\x6e\x74'
2915
 
2916
 
2917
     def testPackRequest0(self):
2918
-        bin = apply(request.ListFontsWithInfo._request.to_binary, (), self.req_args_0)
2919
+        bin = request.ListFontsWithInfo._request.to_binary(*(), **self.req_args_0)
2920
         try:
2921
             assert bin == self.req_bin_0
2922
         except AssertionError:
2923
@@ -2573,7 +2581,7 @@
2924
             raise AssertionError(args)
2925
 
2926
     def testPackReply0(self):
2927
-        bin = apply(request.ListFontsWithInfo._reply.to_binary, (), self.reply_args_0)
2928
+        bin = request.ListFontsWithInfo._reply.to_binary(*(), **self.reply_args_0)
2929
         try:
2930
             assert bin == self.reply_bin_0
2931
         except AssertionError:
2932
@@ -2596,18 +2604,18 @@
2933
         self.req_args_0 = {
2934
             'path': ['foo', 'bar', 'gazonk'],
2935
             }
2936
-        self.req_bin_0 = '\x33\x00\x00\x06' '\x00\x03\x00\x00' \
2937
-            '\x03\x66\x6f\x6f' '\x03\x62\x61\x72' \
2938
-            '\x06\x67\x61\x7a' '\x6f\x6e\x6b\x00'
2939
+        self.req_bin_0 = b'\x33\x00\x00\x06' b'\x00\x03\x00\x00' \
2940
+            b'\x03\x66\x6f\x6f' b'\x03\x62\x61\x72' \
2941
+            b'\x06\x67\x61\x7a' b'\x6f\x6e\x6b\x00'
2942
 
2943
         self.req_args_1 = {
2944
             'path': [],
2945
             }
2946
-        self.req_bin_1 = '\x33\x00\x00\x02' '\x00\x00\x00\x00'
2947
+        self.req_bin_1 = b'\x33\x00\x00\x02' b'\x00\x00\x00\x00'
2948
 
2949
 
2950
     def testPackRequest0(self):
2951
-        bin = apply(request.SetFontPath._request.to_binary, (), self.req_args_0)
2952
+        bin = request.SetFontPath._request.to_binary(*(), **self.req_args_0)
2953
         try:
2954
             assert bin == self.req_bin_0
2955
         except AssertionError:
2956
@@ -2625,7 +2633,7 @@
2957