# How to use test_geometric_mean method in avocado

Best Python code snippet using avocado_python

geometric_mean_test.py

Source:geometric_mean_test.py

`2# third party imports3import numpy as np4# local imports5from gmprocess.metrics.combination.geometric_mean import Geometric_Mean6def test_geometric_mean():7 trace1 = [1, 2, 3]8 trace2 = [4, 5, 6]9 # Test valid10 target = [np.sqrt((1*4)), np.sqrt((2*5)),11 np.sqrt((3*6))]12 gm_data = Geometric_Mean([[], trace1, trace2]).result[1]13 np.testing.assert_array_equal(gm_data, target)14 # Test invalid\15 failed = False16 try:17 gm_data = Geometric_Mean({'HN1': 1, 'HNZ': 2})18 except:19 failed = True20 assert(failed == True)21 # Test invalid\22 failed = False23 try:24 gm_data = Geometric_Mean({'HN1': 1, 'HNZ': 2, 'HN2': 3, 'HN3': 4})25 except:26 failed = True27 assert(failed == True)28if __name__ == '__main__':...`

test_reports.py

Source:test_reports.py

`1from lab import reports2def test_geometric_mean():3 for numbers, mean in [([2, 8], 4), ([4, 1, 1 / 32.], 0.5), ([0], 0)]:...`

## Automation Testing Tutorials

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.