test_compression.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 import sys
3 import rospy
4 import rosunit
5 import unittest
6 
7 from rosbridge_library.internal import pngcompression
8 
9 
10 PKG = 'rosbridge_library'
11 NAME = 'test_compression'
12 
13 
14 class TestCompression(unittest.TestCase):
15 
16  def setUp(self):
17  rospy.init_node(NAME)
18 
19  def test_compress(self):
20  bytes = list(range(128)) * 10000
21  string = str(bytearray(bytes))
22  encoded = pngcompression.encode(string)
23  self.assertNotEqual(string, encoded)
24 
26  bytes = list(range(128)) * 10000
27  string = str(bytearray(bytes))
28  encoded = pngcompression.encode(string)
29  self.assertNotEqual(string, encoded)
30  decoded = pngcompression.decode(encoded)
31  self.assertEqual(string, decoded)
32 
33 
34 if __name__ == '__main__':
35  rosunit.unitrun(PKG, NAME, TestCompression)
36 
test.internal.test_compression.TestCompression.test_compress_decompress
def test_compress_decompress(self)
Definition: test_compression.py:25
test.internal.test_compression.TestCompression.setUp
def setUp(self)
Definition: test_compression.py:16
test.internal.test_compression.TestCompression
Definition: test_compression.py:14
test.internal.test_compression.TestCompression.test_compress
def test_compress(self)
Definition: test_compression.py:19
rosbridge_library.internal
Definition: src/rosbridge_library/internal/__init__.py:1


rosbridge_library
Author(s): Jonathan Mace
autogenerated on Tue Oct 3 2023 02:12:45