2 # Copyright (C) 2019-2024 CEA, EDF
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
26 class TestBase64Conv(unittest.TestCase):
30 This test checks that internal method for Base64 is OK with pickled objects.
31 Reason of home made conversion :
32 old boost base64 conversion failed with (see commit b0f05b249ace88109a4a3d) string of size 124 due to incorrect output after pilot.FromBase64Swig
33 old boost base64 conversion failed with string of size 157 due to an exception thrown by boost
35 for i in range(124,624):
37 a = pickle.dumps(st,protocol=4) # protocol 4 is important here to generate complex
38 self.assertTrue( a == pilot.FromBase64Swig(pilot.ToBase64Swig(a) ) )
43 l = [sin(float(i)) for i in range(1000)]
44 a = pickle.dumps(l,protocol=4)
45 self.assertTrue( a == pilot.FromBase64Swig(pilot.ToBase64Swig(a) ) )
50 if __name__ == '__main__':