cubicweb/test/unittest_binary.py
changeset 11279 e4f11ef1face
parent 11274 d0f6fe008ec4
parent 11057 0b59724cb3f2
child 12355 c703dc95c82e
--- a/cubicweb/test/unittest_binary.py	Fri Jun 10 16:45:20 2016 +0200
+++ b/cubicweb/test/unittest_binary.py	Thu Jun 16 15:53:01 2016 +0200
@@ -1,10 +1,29 @@
-from six import PY2
+# copyright 2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
+#
+# This file is part of CubicWeb.
+#
+# CubicWeb is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation, either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License along
+# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
 
 from unittest import TestCase
-from tempfile import NamedTemporaryFile
 import os.path as osp
+import pickle
+
+from six import PY2
 
 from logilab.common.shellutils import tempdir
+
 from cubicweb import Binary
 
 
@@ -48,6 +67,11 @@
             bobj = Binary.from_file(fpath)
             self.assertEqual(bobj.getvalue(), b'binaryblob')
 
+    def test_pickleable(self):
+        b = Binary(b'toto')
+        bb = pickle.loads(pickle.dumps(b))
+        self.assertEqual(b, bb)
+
 
 if __name__ == '__main__':
     from unittest import main