Best Python code snippet using avocado_python
safeloader.py
Source:safeloader.py
...100 continue101 if method_pattern is None:102 methods = [st.name for st in statement.body if103 isinstance(st, ast.FunctionDef)]104 methods = data_structures.ordered_list_unique(methods)105 else:106 methods = [st.name for st in statement.body if107 isinstance(st, ast.FunctionDef) and108 method_pattern.match(st.name)]109 methods = data_structures.ordered_list_unique(methods)110 result[statement.name] = methods...
test_data_structures.py
Source:test_data_structures.py
...7class TestDataStructures(unittest.TestCase):8 """9 Unit tests for avocado.utils.data_structures10 """11 def test_ordered_list_unique(self):12 """13 Verify only unique items are there and the order is kept14 """15 orig = [1, 5, unittest, 1, 3, 'a', 7, 7, None, 0, unittest]16 self.assertEqual(data_structures.ordered_list_unique(orig),17 [1, 5, unittest, 3, 'a', 7, None, 0])18 def test_geometric_mean(self):19 """20 Verify the correct value is produced and it allows processing of long21 lists of values where some algorithm fails.22 """23 self.assertEqual(data_structures.geometric_mean(xrange(1, 180)),24 67.1555819421869)25 def test_compare_matrices(self):26 """27 Verify the correct value is produced when comparing matrices.28 """29 # Note that first row contains header in first column, while the30 # second contains only values (for testing purposes)...
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!!