Best Python code snippet using yandex-tank
test_zeromq.py
Source:test_zeromq.py
1"""2Test salt.utils.zeromq3"""4import salt.utils.zeromq5import zmq6from salt._compat import ipaddress7from salt.exceptions import SaltSystemExit8from tests.support.mock import patch9from tests.support.unit import TestCase, skipIf10class UtilsTestCase(TestCase):11 def test_ip_bracket(self):12 test_ipv4 = "127.0.0.1"13 test_ipv6 = "::1"14 test_ipv6_uri = "[::1]"15 self.assertEqual(test_ipv4, salt.utils.zeromq.ip_bracket(test_ipv4))16 self.assertEqual(17 "[{}]".format(test_ipv6), salt.utils.zeromq.ip_bracket(test_ipv6)18 )19 self.assertEqual(20 "[{}]".format(test_ipv6), salt.utils.zeromq.ip_bracket(test_ipv6_uri)21 )22 ip_addr_obj = ipaddress.ip_address(test_ipv4)23 self.assertEqual(test_ipv4, salt.utils.zeromq.ip_bracket(ip_addr_obj))24 @skipIf(25 not hasattr(zmq, "IPC_PATH_MAX_LEN"), "ZMQ does not have max length support."26 )27 def test_check_ipc_length(self):28 """29 Ensure we throw an exception if we have a too-long IPC URI30 """31 with patch("zmq.IPC_PATH_MAX_LEN", 1):32 self.assertRaises(33 SaltSystemExit, salt.utils.zeromq.check_ipc_path_max_len, "1" * 1024...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!