coding style: autopep8 in an aggressive mode (-aaaaaaaaaa)

I decided to skip the following chunk of the diff because I think that
it would actually made the code a bit harder to read:

diff --git gnpy/core/service_sheet.py gnpy/core/service_sheet.py
index 9965840..9834111 100644
--- gnpy/core/service_sheet.py
+++ gnpy/core/service_sheet.py
@@ -41,8 +41,22 @@ logger = getLogger(__name__)

 class Request(namedtuple('Request', 'request_id source destination trx_type mode \
     spacing power nb_channel disjoint_from nodes_list is_loose path_bandwidth')):
-    def __new__(cls, request_id, source, destination, trx_type,  mode=None, spacing=None, power=None, nb_channel=None, disjoint_from='',  nodes_list=None, is_loose='', path_bandwidth=None):
-        return super().__new__(cls, request_id, source, destination, trx_type, mode, spacing, power, nb_channel, disjoint_from,  nodes_list, is_loose, path_bandwidth)
+    def __new__(
+            cls,
+            request_id,
+            source,
+            destination,
+            trx_type,
+            mode=None,
+            spacing=None,
+            power=None,
+            nb_channel=None,
+            disjoint_from='',
+            nodes_list=None,
+            is_loose='',
+            path_bandwidth=None):
+        return super().__new__(cls, request_id, source, destination, trx_type, mode, spacing,
+                               power, nb_channel, disjoint_from, nodes_list, is_loose, path_bandwidth)

 # Type for output data:  // from dutc

diff --git tests/test_automaticmodefeature.py tests/test_automaticmodefeature.py
index 0e5f633..5ba5881 100644
--- tests/test_automaticmodefeature.py
+++ tests/test_automaticmodefeature.py
@@ -32,7 +32,26 @@ eqpt_library_name = Path(__file__).parent.parent / 'tests/data/eqpt_config.json'
 @pytest.mark.parametrize("net", [network_file_name])
 @pytest.mark.parametrize("eqpt", [eqpt_library_name])
 @pytest.mark.parametrize("serv", [service_file_name])
-@pytest.mark.parametrize("expected_mode", [['16QAM', 'PS_SP64_1', 'PS_SP64_1', 'PS_SP64_1', 'mode 2 - fake', 'mode 2', 'PS_SP64_1', 'mode 3', 'PS_SP64_1', 'PS_SP64_1', '16QAM', 'mode 1', 'PS_SP64_1', 'PS_SP64_1', 'mode 1', 'mode 2', 'mode 1', 'mode 2', 'nok']])
+@pytest.mark.parametrize("expected_mode",
+                         [['16QAM',
+                           'PS_SP64_1',
+                           'PS_SP64_1',
+                           'PS_SP64_1',
+                           'mode 2 - fake',
+                           'mode 2',
+                           'PS_SP64_1',
+                           'mode 3',
+                           'PS_SP64_1',
+                           'PS_SP64_1',
+                           '16QAM',
+                           'mode 1',
+                           'PS_SP64_1',
+                           'PS_SP64_1',
+                           'mode 1',
+                           'mode 2',
+                           'mode 1',
+                           'mode 2',
+                           'nok']])
 def test_automaticmodefeature(net, eqpt, serv, expected_mode):
     equipment = load_equipment(eqpt)
     network = load_network(net, equipment)

Change-Id: I522c45c079b3a9540568657e2ae0a4bfc5fb1272
This commit is contained in:
Jan Kundrát
2020-05-19 12:44:00 +02:00
parent 3548ed74e2
commit 46f89aa770
17 changed files with 309 additions and 300 deletions

View File

@@ -42,8 +42,8 @@ equipment = load_equipment(eqpt_filename)
@pytest.mark.parametrize('xls_input,expected_json_output', {
DATA_DIR / 'CORONET_Global_Topology.xlsx': DATA_DIR / 'CORONET_Global_Topology_expected.json',
DATA_DIR / 'testTopology.xls': DATA_DIR / 'testTopology_expected.json',
DATA_DIR / 'CORONET_Global_Topology.xlsx': DATA_DIR / 'CORONET_Global_Topology_expected.json',
DATA_DIR / 'testTopology.xls': DATA_DIR / 'testTopology_expected.json',
}.items())
def test_excel_json_generation(xls_input, expected_json_output):
""" tests generation of topology json
@@ -156,8 +156,8 @@ def test_auto_design_generation_fromjson(json_input, expected_json_output):
@pytest.mark.parametrize('xls_input,expected_json_output', {
DATA_DIR / 'testTopology.xls': DATA_DIR / 'testTopology_services_expected.json',
DATA_DIR / 'testService.xls': DATA_DIR / 'testService_services_expected.json'
DATA_DIR / 'testTopology.xls': DATA_DIR / 'testTopology_services_expected.json',
DATA_DIR / 'testService.xls': DATA_DIR / 'testService_services_expected.json'
}.items())
def test_excel_service_json_generation(xls_input, expected_json_output):
""" test services creation
@@ -193,7 +193,7 @@ def test_excel_service_json_generation(xls_input, expected_json_output):
@pytest.mark.parametrize('json_input, csv_output', {
DATA_DIR / 'testTopology_response.json': DATA_DIR / 'testTopology_response',
DATA_DIR / 'testTopology_response.json': DATA_DIR / 'testTopology_response',
}.items())
def test_csv_response_generation(json_input, csv_output):
""" tests if generated csv is consistant with expected generation
@@ -202,11 +202,11 @@ def test_csv_response_generation(json_input, csv_output):
with open(json_input) as jsonfile:
json_data = load(jsonfile)
equipment = load_equipment(eqpt_filename)
csv_filename = str(csv_output)+'.csv'
csv_filename = str(csv_output) + '.csv'
with open(csv_filename, 'w', encoding='utf-8') as fcsv:
jsontocsv(json_data, equipment, fcsv)
expected_csv_filename = str(csv_output)+'_expected.csv'
expected_csv_filename = str(csv_output) + '_expected.csv'
# expected header
# csv_header = \
@@ -266,14 +266,14 @@ def compare_response(exp_resp, act_resp):
print(act_resp)
test = True
for key in act_resp.keys():
if not key in exp_resp.keys():
if key not in exp_resp.keys():
print(f'{key} is not expected')
return False
if isinstance(act_resp[key], dict):
test = compare_response(exp_resp[key], act_resp[key])
if test:
for key in exp_resp.keys():
if not key in act_resp.keys():
if key not in act_resp.keys():
print(f'{key} is expected')
return False
if isinstance(exp_resp[key], dict):
@@ -290,7 +290,7 @@ def compare_response(exp_resp, act_resp):
# test json answers creation
@pytest.mark.parametrize('xls_input, expected_response_file', {
DATA_DIR / 'testTopology.xls': DATA_DIR / 'testTopology_response.json',
DATA_DIR / 'testTopology.xls': DATA_DIR / 'testTopology_response.json',
}.items())
def test_json_response_generation(xls_input, expected_response_file):
""" tests if json response is correctly generated for all combinations of requests