From 11a3333b248efed50b9ce2921dac5c14ba93449d Mon Sep 17 00:00:00 2001 From: Ben Hovinga <23349127+benhovinga@users.noreply.github.com> Date: Sat, 30 Dec 2023 19:39:05 -0330 Subject: [PATCH 1/7] reformated test strings to comply with E501 --- aamva_standard/test_barcode.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/aamva_standard/test_barcode.py b/aamva_standard/test_barcode.py index 15530fa..d31f0ab 100644 --- a/aamva_standard/test_barcode.py +++ b/aamva_standard/test_barcode.py @@ -6,7 +6,11 @@ # ((test_string, designators, expects), ...) ( # AAMVA Version 1 - "@\n\x1e\rANSI 6360000102DL00390187ZV02260032DLDAQ0123456789ABC\nDAAPUBLIC,JOHN,Q\nDAG123 MAIN STREET\nDAIANYTOWN\nDAJVA\nDAK123459999 \nDARDM \nDAS \nDAT \nDAU509\nDAW175\nDAYBL \nDAZBR \nDBA20011201\nDBB19761123\nDBCM\nDBD19961201\rZVZVAJURISDICTIONDEFINEDELEMENT\r", + "@\n\x1e\rANSI 6360000102DL00390187ZV02260032DLDAQ0123456789ABC\n" + + "DAAPUBLIC,JOHN,Q\nDAG123 MAIN STREET\nDAIANYTOWN\nDAJVA\n" + + "DAK123459999 \nDARDM \nDAS \nDAT \nDAU509\nDAW175\n" + + "DAYBL \nDAZBR \nDBA20011201\nDBB19761123\nDBCM\nDBD19961201\r" + + "ZVZVAJURISDICTIONDEFINEDELEMENT\r", ( ("DL", 39, 187), ("ZV", 226, 32) @@ -49,7 +53,12 @@ ), ( # AAMVA Version 10 - "@\n\x1e\rANSI 636000100102DL00410278ZV03190008DLDAQT64235789\nDCSSAMPLE\nDDEN\nDACMICHAEL\nDDFN\nDADJOHN\nDDGN\nDCUJR\nDCAD\nDCBK\nDCDPH\nDBD06062019\nDBB06061986\nDBA12102024\nDBC1\nDAU068 in\nDAYBRO\nDAG2300 WEST BROAD STREET\nDAIRICHMOND\nDAJVA\nDAK232690000 \nDCF2424244747474786102204\nDCGUSA\nDCK123456789\nDDAF\nDDB06062018\nDDC06062020\nDDD1\rZVZVA01\r", + "@\n\x1e\rANSI 636000100102DL00410278ZV03190008DLDAQT64235789\n" + + "DCSSAMPLE\nDDEN\nDACMICHAEL\nDDFN\nDADJOHN\nDDGN\nDCUJR\nDCAD\n" + + "DCBK\nDCDPH\nDBD06062019\nDBB06061986\nDBA12102024\nDBC1\n" + + "DAU068 in\nDAYBRO\nDAG2300 WEST BROAD STREET\nDAIRICHMOND\nDAJVA\n" + + "DAK232690000 \nDCF2424244747474786102204\nDCGUSA\nDCK123456789\n" + + "DDAF\nDDB06062018\nDDC06062020\nDDD1\rZVZVA01\r", ( ("DL", 41, 278), ("ZV", 319, 8) From ed9e380d77620b714600c063e4380fbabdab04f5 Mon Sep 17 00:00:00 2001 From: Ben Hovinga <23349127+benhovinga@users.noreply.github.com> Date: Sat, 30 Dec 2023 19:47:06 -0330 Subject: [PATCH 2/7] restyled comment to fix E501 ./aamva_standard/issuing_authority.py:86:80: E501 line too long (80 > 79 characters) --- aamva_standard/issuing_authority.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aamva_standard/issuing_authority.py b/aamva_standard/issuing_authority.py index 250c638..2676b4e 100644 --- a/aamva_standard/issuing_authority.py +++ b/aamva_standard/issuing_authority.py @@ -10,6 +10,7 @@ class IssuingAuthority: ISSUING_AUTHORITIES = ( + # Source: https://www.aamva.org/identity/issuer-identification-numbers-(iin) IssuingAuthority(604426, "Prince Edward Island", "PE", "Canada"), IssuingAuthority(604427, "American Samoa", "AS", "USA"), IssuingAuthority(604428, "Quebec", "GC", "Canada"), @@ -83,7 +84,6 @@ class IssuingAuthority: IssuingAuthority(636061, "West Virginia", "WV", "USA"), IssuingAuthority(636062, "Virgin Islands", "VI", "USA"), ) -"""Source: https://www.aamva.org/identity/issuer-identification-numbers-(iin)""" def get_authority_by_id(id_number: int) -> IssuingAuthority: From 1c1c2e1fa46ee085cfba34df27803d7df322352b Mon Sep 17 00:00:00 2001 From: Ben Hovinga <23349127+benhovinga@users.noreply.github.com> Date: Sat, 30 Dec 2023 19:50:28 -0330 Subject: [PATCH 3/7] fix E501 on source ./aamva_standard/issuing_authority.py:13:80: E501 line too long (80 > 79 characters) --- aamva_standard/issuing_authority.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aamva_standard/issuing_authority.py b/aamva_standard/issuing_authority.py index 2676b4e..c9e5575 100644 --- a/aamva_standard/issuing_authority.py +++ b/aamva_standard/issuing_authority.py @@ -10,7 +10,8 @@ class IssuingAuthority: ISSUING_AUTHORITIES = ( - # Source: https://www.aamva.org/identity/issuer-identification-numbers-(iin) + # Source: + # https://www.aamva.org/identity/issuer-identification-numbers-(iin) IssuingAuthority(604426, "Prince Edward Island", "PE", "Canada"), IssuingAuthority(604427, "American Samoa", "AS", "USA"), IssuingAuthority(604428, "Quebec", "GC", "Canada"), From a1e64f247a727af8bd50c05868191bbd67bd4893 Mon Sep 17 00:00:00 2001 From: Ben Hovinga <23349127+benhovinga@users.noreply.github.com> Date: Sat, 30 Dec 2023 20:04:11 -0330 Subject: [PATCH 4/7] fix E501 on get_authority_by_id ./aamva_standard/issuing_authority.py:92:80: E501 line too long (107 > 79 characters) also renamed the variable to issuing_authority as we should get a single IssuingAuthority object. --- aamva_standard/issuing_authority.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/aamva_standard/issuing_authority.py b/aamva_standard/issuing_authority.py index c9e5575..88f387b 100644 --- a/aamva_standard/issuing_authority.py +++ b/aamva_standard/issuing_authority.py @@ -89,7 +89,10 @@ class IssuingAuthority: def get_authority_by_id(id_number: int) -> IssuingAuthority: try: - _map = tuple(filter(lambda i: i.issuer_identification_number == id_number, ISSUING_AUTHORITIES))[0] + issuing_authority = tuple( + filter( + lambda i: i.issuer_identification_number == id_number, + ISSUING_AUTHORITIES))[0] except IndexError: raise KeyError(f"id_number: {id_number}, not found") - return _map + return issuing_authority From 1a94c1fc0597c06322fe84306b1cbe413ee9034b Mon Sep 17 00:00:00 2001 From: Ben Hovinga <23349127+benhovinga@users.noreply.github.com> Date: Sat, 30 Dec 2023 20:23:58 -0330 Subject: [PATCH 5/7] renamed symbols for clarity --- aamva_standard/test_issuing_authority.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/aamva_standard/test_issuing_authority.py b/aamva_standard/test_issuing_authority.py index 693c109..67d2e51 100644 --- a/aamva_standard/test_issuing_authority.py +++ b/aamva_standard/test_issuing_authority.py @@ -3,7 +3,7 @@ @pytest.fixture -def authority_list(): +def issuing_authorities_testdata(): return ( issuing_authority.IssuingAuthority(100001, "Test Jurisdiction 1", "T1", "Canada"), issuing_authority.IssuingAuthority(100002, "Test Jurisdiction 2", "T2", "USA") @@ -11,15 +11,15 @@ def authority_list(): @pytest.fixture -def fake_authority_list(authority_list): - saved_list = issuing_authority.ISSUING_AUTHORITIES - issuing_authority.ISSUING_AUTHORITIES = authority_list +def fake_authority_list(issuing_authorities_testdata): + saved_authorities = issuing_authority.ISSUING_AUTHORITIES + issuing_authority.ISSUING_AUTHORITIES = issuing_authorities_testdata yield None - issuing_authority.ISSUING_AUTHORITIES = saved_list + issuing_authority.ISSUING_AUTHORITIES = saved_authorities -def test_get_authority_by_id(fake_authority_list, authority_list): - assert issuing_authority.get_authority_by_id(100001) == authority_list[0] - assert issuing_authority.get_authority_by_id(100002) == authority_list[1] +def test_get_authority_by_id(fake_authority_list, issuing_authorities_testdata): + assert issuing_authority.get_authority_by_id(100001) == issuing_authorities_testdata[0] + assert issuing_authority.get_authority_by_id(100002) == issuing_authorities_testdata[1] with pytest.raises(KeyError, match="not found"): issuing_authority.get_authority_by_id(1) From 3edb757f567ee99414453ed308af45f2136fbbb4 Mon Sep 17 00:00:00 2001 From: Ben Hovinga <23349127+benhovinga@users.noreply.github.com> Date: Sat, 30 Dec 2023 20:29:55 -0330 Subject: [PATCH 6/7] fix E501 on issuing_authorities_testdata ./aamva_standard/test_issuing_authority.py:8:80: E501 line too long (90 > 79 characters) ./aamva_standard/test_issuing_authority.py:9:80: E501 line too long (86 > 79 characters) --- aamva_standard/test_issuing_authority.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/aamva_standard/test_issuing_authority.py b/aamva_standard/test_issuing_authority.py index 67d2e51..76eed1f 100644 --- a/aamva_standard/test_issuing_authority.py +++ b/aamva_standard/test_issuing_authority.py @@ -5,8 +5,10 @@ @pytest.fixture def issuing_authorities_testdata(): return ( - issuing_authority.IssuingAuthority(100001, "Test Jurisdiction 1", "T1", "Canada"), - issuing_authority.IssuingAuthority(100002, "Test Jurisdiction 2", "T2", "USA") + issuing_authority.IssuingAuthority( + 100001, "Test Jurisdiction 1", "T1", "Canada"), + issuing_authority.IssuingAuthority( + 100002, "Test Jurisdiction 2", "T2", "USA") ) From 064b09bdb89d2c6ccb6df6eddda30724236c1fd8 Mon Sep 17 00:00:00 2001 From: Ben Hovinga <23349127+benhovinga@users.noreply.github.com> Date: Sat, 30 Dec 2023 20:36:23 -0330 Subject: [PATCH 7/7] fix E501 in test_get_authority_by_id ./aamva_standard/test_issuing_authority.py:23:80: E501 line too long (80 > 79 characters) ./aamva_standard/test_issuing_authority.py:24:80: E501 line too long (91 > 79 characters) ./aamva_standard/test_issuing_authority.py:25:80: E501 line too long (91 > 79 characters) --- aamva_standard/test_issuing_authority.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/aamva_standard/test_issuing_authority.py b/aamva_standard/test_issuing_authority.py index 76eed1f..bf609bb 100644 --- a/aamva_standard/test_issuing_authority.py +++ b/aamva_standard/test_issuing_authority.py @@ -20,8 +20,11 @@ def fake_authority_list(issuing_authorities_testdata): issuing_authority.ISSUING_AUTHORITIES = saved_authorities -def test_get_authority_by_id(fake_authority_list, issuing_authorities_testdata): - assert issuing_authority.get_authority_by_id(100001) == issuing_authorities_testdata[0] - assert issuing_authority.get_authority_by_id(100002) == issuing_authorities_testdata[1] +def test_get_authority_by_id( + fake_authority_list, issuing_authorities_testdata): + assert (issuing_authority.get_authority_by_id(100001) == + issuing_authorities_testdata[0]) + assert (issuing_authority.get_authority_by_id(100002) == + issuing_authorities_testdata[1]) with pytest.raises(KeyError, match="not found"): issuing_authority.get_authority_by_id(1)