Innovenergy_trunk/NodeRed/NodeRedFiles/pika-0.13.1/tests/unit/compat_tests.py

25 lines
726 B
Python
Raw Normal View History

2024-06-05 10:33:44 +00:00
import unittest
from pika import compat
class UtilsTests(unittest.TestCase):
def test_get_linux_version_normal(self):
self.assertEqual(
compat.get_linux_version("4.11.0-2-amd64"), (4, 11, 0))
def test_get_linux_version_short(self):
self.assertEqual(compat.get_linux_version("4.11.0"), (4, 11, 0))
def test_get_linux_version_gcp(self):
self.assertEqual(compat.get_linux_version("4.4.64+"), (4, 4, 64))
def test_to_digit(self):
self.assertEqual(compat.to_digit("64"), 64)
def test_to_digit_with_plus_sign(self):
self.assertEqual(compat.to_digit("64+"), 64)
def test_to_digit_with_dot(self):
self.assertEqual(compat.to_digit("64."), 64)