Best Python code snippet using localstack_python
test_common.py
Source:test_common.py
...127 finally:128 tcp.close()129 self.assertTrue(common.port_can_be_bound(port))130 def test_to_unique_item_list(self):131 self.assertListEqual([1, 2, 3], common.to_unique_items_list([1, 1, 2, 2, 3]))132 self.assertListEqual(["a"], common.to_unique_items_list(["a"]))133 self.assertListEqual(["a", "b"], common.to_unique_items_list(["a", "b", "a"]))134 self.assertListEqual(["a", "b"], common.to_unique_items_list("aba"))135 self.assertListEqual([], common.to_unique_items_list([]))136 def comparator_lower(first, second):137 return first.lower() == second.lower()138 self.assertListEqual(["a", "A"], common.to_unique_items_list(["a", "A", "a"]))139 self.assertListEqual(["a"], common.to_unique_items_list(["a", "A", "a"], comparator_lower))140 self.assertListEqual(["a"], common.to_unique_items_list(["a", "A", "a"], comparator_lower))141 def comparator_str_int(first, second):142 return int(first) - int(second)143 self.assertListEqual(144 ["1", "2"], common.to_unique_items_list(["1", "2", "1", "2"], comparator_str_int)145 )146 def test_retry(self):147 exceptions = list()148 count = itertools.count()149 def fn():150 i = next(count)151 e = RuntimeError("exception %d" % i)152 exceptions.append(e)153 if i == 2:154 return "two"155 raise e156 ret = common.retry(fn, retries=3, sleep=0.001)157 self.assertEqual("two", ret)158 self.assertEqual(3, len(exceptions))...
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!!