mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-10-31 10:48:02 +00:00 
			
		
		
		
	lf_graph.py lf_report_test.py : pep8 complience
Signed-off-by: Chuck SmileyRekiere <chuck.smileyrekiere@candelatech.com>
This commit is contained in:
		| @@ -2,13 +2,13 @@ | ||||
| ''' | ||||
| NAME: lf_report_test.py | ||||
|  | ||||
| PURPOSE:  | ||||
| PURPOSE: | ||||
| Common file for testing lf_report and lf_graph Library generates html and pdf output | ||||
|  | ||||
| SETUP:   | ||||
| SETUP: | ||||
| /lanforge/html-reports directory needs to be present or output generated in local file | ||||
|  | ||||
| EXAMPLE:   | ||||
| EXAMPLE: | ||||
| ./lf_report_test.py : currently script does not accept input | ||||
|  | ||||
| COPYWRITE | ||||
| @@ -28,7 +28,7 @@ import pdfkit | ||||
| import random | ||||
| import argparse | ||||
|  | ||||
|   | ||||
|  | ||||
| sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../"))) | ||||
|  | ||||
| lf_report = importlib.import_module("py-scripts.lf_report") | ||||
| @@ -40,22 +40,24 @@ lf_stacked_graph = lf_graph.lf_stacked_graph | ||||
| lf_horizontal_stacked_graph = lf_graph.lf_horizontal_stacked_graph | ||||
|  | ||||
| # Unit Test | ||||
|  | ||||
|  | ||||
| def main(): | ||||
|     # Testing: generate data frame | ||||
|     parser = argparse.ArgumentParser( | ||||
|         prog="lf_report_test.py", | ||||
|         formatter_class=argparse.RawTextHelpFormatter, | ||||
|         description='''\ | ||||
| -----------------    | ||||
| ----------------- | ||||
| NAME: lf_report_test.py | ||||
|  | ||||
| PURPOSE:  | ||||
| PURPOSE: | ||||
| Common file for testing lf_report and lf_graph Library generates html and pdf output | ||||
|  | ||||
| SETUP:   | ||||
| SETUP: | ||||
| /lanforge/html-reports directory needs to be present or output generated in local file | ||||
|  | ||||
| EXAMPLE:   | ||||
| EXAMPLE: | ||||
| ./lf_report_test.py : currently script does not accept input | ||||
|  | ||||
| COPYWRITE | ||||
| @@ -65,8 +67,13 @@ COPYWRITE | ||||
| INCLUDE_IN_README | ||||
| ''') | ||||
|  | ||||
|     parser.add_argument('--mgr','--lfmgr', dest='lfmgr', help='sample argument: where LANforge GUI is running', default='localhost') | ||||
|     # the args parser is not really used , this is so the report is not generated when testing  | ||||
|     parser.add_argument( | ||||
|         '--mgr', | ||||
|         '--lfmgr', | ||||
|         dest='lfmgr', | ||||
|         help='sample argument: where LANforge GUI is running', | ||||
|         default='localhost') | ||||
|     # the args parser is not really used , this is so the report is not generated when testing | ||||
|     # the imports with --help | ||||
|     args = parser.parse_args() | ||||
|     print("LANforge manager {lfmgr}".format(lfmgr=args.lfmgr)) | ||||
| @@ -82,7 +89,7 @@ INCLUDE_IN_README | ||||
|  | ||||
|     print(dataframe) | ||||
|  | ||||
|     # Testing: generate data frame  | ||||
|     # Testing: generate data frame | ||||
|     dataframe2 = pd.DataFrame({ | ||||
|         'station': [1, 2, 3, 4, 5, 6, 7], | ||||
|         'time_seconds': [23, 78, 22, 19, 45, 22, 25] | ||||
| @@ -137,7 +144,7 @@ INCLUDE_IN_README | ||||
|                          _xaxis_categories=x_axis_values, | ||||
|                          _graph_image_name="Bi-single_radio_2.4GHz", | ||||
|                          _label=["bi-downlink", "bi-uplink", 'uplink'], | ||||
|                          _color=['darkorange', 'forestgreen','blueviolet'], | ||||
|                          _color=['darkorange', 'forestgreen', 'blueviolet'], | ||||
|                          _color_edge='red', | ||||
|                          _grp_title="Throughput for each clients", | ||||
|                          _xaxis_step=5, | ||||
| @@ -146,7 +153,7 @@ INCLUDE_IN_README | ||||
|                          _text_rotation=45, | ||||
|                          _xticks_font=7, | ||||
|                          _legend_loc="best", | ||||
|                          _legend_box=(1,1), | ||||
|                          _legend_box=(1, 1), | ||||
|                          _legend_ncol=1, | ||||
|                          _legend_fontsize=None, | ||||
|                          _enable_csv=True) | ||||
| @@ -156,7 +163,7 @@ INCLUDE_IN_README | ||||
|     print("graph name {}".format(graph_png)) | ||||
|  | ||||
|     report.set_graph_image(graph_png) | ||||
|     # need to move the graph image to the results  | ||||
|     # need to move the graph image to the results | ||||
|     report.move_graph_image() | ||||
|     if graph.enable_csv: | ||||
|         report.set_csv_filename(graph_png) | ||||
| @@ -169,7 +176,7 @@ INCLUDE_IN_README | ||||
|                               _graph_image_name="image_name1", | ||||
|                               _color=None, | ||||
|                               _label=["s1", "s2", "s3"], | ||||
|                               _enable_csv = False) | ||||
|                               _enable_csv=False) | ||||
|     graph_png = graph2.build_scatter_graph() | ||||
|  | ||||
|     print("graph name {}".format(graph_png)) | ||||
| @@ -178,14 +185,15 @@ INCLUDE_IN_README | ||||
|     report.move_graph_image() | ||||
|  | ||||
|     report.build_graph() | ||||
|     # this will generate graph which is independent,we can customize the value with different colors | ||||
|     # this will generate graph which is independent,we can customize the value | ||||
|     # with different colors | ||||
|     graph2 = lf_scatter_graph(_x_data_set=set1, _y_data_set=[45, 67, 45, 34], _values=[0, 0, 0, 1], | ||||
|                               _xaxis_name="x-axis", | ||||
|                               _yaxis_name="y-axis", | ||||
|                               _graph_image_name="image_name_map", | ||||
|                               _color=None, | ||||
|                               _label=["s1", "s2"], | ||||
|                               _enable_csv = False) | ||||
|                               _enable_csv=False) | ||||
|     graph_png = graph2.build_scatter_graph() | ||||
|  | ||||
|     print("graph name {}".format(graph_png)) | ||||
| @@ -194,14 +202,15 @@ INCLUDE_IN_README | ||||
|     report.move_graph_image() | ||||
|  | ||||
|     report.build_graph() | ||||
|     dataset = [["1", "2", "3", "4"], [12, 45, 67, 34], [23, 67, 23, 12], [25, 45, 34, 23]] | ||||
|     dataset = [["1", "2", "3", "4"], [12, 45, 67, 34], | ||||
|                [23, 67, 23, 12], [25, 45, 34, 23]] | ||||
|     graph = lf_stacked_graph(_data_set=dataset, | ||||
|                              _xaxis_name="Stations", | ||||
|                              _yaxis_name="Login PASS/FAIL", | ||||
|                              _label=['Success', 'Fail', 'both'], | ||||
|                              _graph_image_name="login_pass_fail1", | ||||
|                              _color=None, | ||||
|                              _enable_csv = False) | ||||
|                              _enable_csv=False) | ||||
|  | ||||
|     graph_png = graph.build_stacked_graph() | ||||
|  | ||||
| @@ -221,7 +230,7 @@ INCLUDE_IN_README | ||||
|                                         _graph_image_name="image_name_pass_fail", | ||||
|                                         _color=["r", "g"], | ||||
|                                         _figsize=(9, 4), | ||||
|                                         _enable_csv = False) | ||||
|                                         _enable_csv=False) | ||||
|  | ||||
|     graph_png = graph.build_horizontal_stacked_graph() | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Chuck SmileyRekiere
					Chuck SmileyRekiere