python/samba: Add binary_type for p2/p3 testing.
authorNoel Power <noel.power@suse.com>
Tue, 24 Apr 2018 15:28:41 +0000 (16:28 +0100)
committerNoel Power <npower@samba.org>
Mon, 30 Apr 2018 13:43:19 +0000 (15:43 +0200)
For helping test for binary types, binary_type evaluates to 'str'
in py2, and 'bytes' in py3.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
python/samba/compat.py

index 5662095fed527f9159b625c495c28a2536a7d769..042fc86a44040f2643b14252f88c4aa290439689 100644 (file)
@@ -30,6 +30,7 @@ if PY3:
     integer_types = int,
     string_types = str
     text_type = str
     integer_types = int,
     string_types = str
     text_type = str
+    binary_type = bytes
 
     # alias
     import io
 
     # alias
     import io
@@ -43,6 +44,7 @@ else:
     integer_types = (int, long)
     string_types = basestring
     text_type = unicode
     integer_types = (int, long)
     string_types = basestring
     text_type = unicode
+    binary_type = str
 
     # alias
     import StringIO
 
     # alias
     import StringIO