format everything with black

This commit is contained in:
Istvan Ruzman
2020-09-21 18:16:03 +02:00
parent 2b5e7ceeed
commit 334445c54e
12 changed files with 353 additions and 426 deletions

View File

@@ -63,9 +63,7 @@ def test_valid_vendor_definitions(vendor):
def test_closing_wrong_vendor():
dictionary = StringIO(
"VENDOR TEST-VENDOR 1234\n"
"BEGIN-VENDOR TEST-VENDOR\n"
"END-VENDOR WRONG-VENDOR"
"VENDOR TEST-VENDOR 1234\n" "BEGIN-VENDOR TEST-VENDOR\n" "END-VENDOR WRONG-VENDOR"
)
with pytest.raises(ParseError):
Dictionary("", dictionary)
@@ -121,8 +119,7 @@ def test_valid_attribute_numbers(number):
@pytest.mark.parametrize(
"invalid_number",
["1000", "ABCD", "-1", "inf", "INF", "-INF", "2e4", "2.5e3"],
"invalid_number", ["1000", "ABCD", "-1", "inf", "INF", "-INF", "2e4", "2.5e3"],
)
def test_invalid_attribute_numbers(invalid_number):
dictionary = StringIO(f"ATTRIBUTE NAME {invalid_number} integer64")
@@ -160,8 +157,7 @@ def test_invalid_attr_type():
@pytest.mark.parametrize("value", ["1", "0x1", "0o1"])
def test_value_definition(value):
dictionary = StringIO(
"ATTRIBUTE TEST-ATTRIBUTE 1 byte\n"
f"VALUE TEST-ATTRIBUTE TEST-VALUE {value}"
"ATTRIBUTE TEST-ATTRIBUTE 1 byte\n" f"VALUE TEST-ATTRIBUTE TEST-VALUE {value}"
)
Dictionary("", dictionary)
@@ -290,9 +286,7 @@ def test_valid_datatypes_in_vendor_space(datatype):
Dictionary("", dictionary)
@pytest.mark.parametrize(
"datatype", ["concat", "extended", "long-extended", "evs"]
)
@pytest.mark.parametrize("datatype", ["concat", "extended", "long-extended", "evs"])
def test_invalid_datatypes_in_vendor_space(datatype):
dictionary = StringIO(
"VENDOR TEST 1234\n"
@@ -305,8 +299,7 @@ def test_invalid_datatypes_in_vendor_space(datatype):
@pytest.mark.parametrize(
"invalid_number",
["ABCD", "-1", "inf", "INF", "-INF", "0.1", "2e4", "2.5e3"],
"invalid_number", ["ABCD", "-1", "inf", "INF", "-INF", "0.1", "2e4", "2.5e3"],
)
def test_invalid_value_numbers(invalid_number):
dictionary = StringIO(
@@ -340,9 +333,7 @@ def test_value_for_non_existing_attribute():
],
)
def test_value_for_wrong_datatype(datatype):
dictionary = StringIO(
f"ATTRIBUTE NAME 123 {datatype}\n" "VALUE NAME VNAME 256"
)
dictionary = StringIO(f"ATTRIBUTE NAME 123 {datatype}\n" "VALUE NAME VNAME 256")
with pytest.raises(ParseError):
Dictionary("", dictionary)
@@ -398,9 +389,7 @@ def test_get_attributes_from_dictionaries(attribute):
_ = dd[attribute]
@pytest.mark.parametrize(
"attribute", ["RFC-ATTRIBUTE1", 8, (26, 5556, 7), (26, 5555, 8)]
)
@pytest.mark.parametrize("attribute", ["RFC-ATTRIBUTE1", 8, (26, 5556, 7), (26, 5555, 8)])
def test_get_nonexisting_attributes_from_dictionaries(attribute):
dictionary = StringIO(
"ATTRIBUTE RFC-ATTRIBUTE 7 integer\n"

View File

@@ -148,9 +148,7 @@ def flattened_product(l1, l2):
return result
VENDOR_TEST_ATTRIBUTES = flattened_product(
VENDOR_FORMAT_COMBINATIONS, TEST_ATTRIBUTES
)
VENDOR_TEST_ATTRIBUTES = flattened_product(VENDOR_FORMAT_COMBINATIONS, TEST_ATTRIBUTES)
VENDOR_TAGGED_ATTRIBUTES = flattened_product(
VENDOR_FORMAT_COMBINATIONS, TAGGED_ATTRIBUTES
)
@@ -206,13 +204,7 @@ def generate_vendor_attribute(vendor_id, tlen, llen, attr_bytes):
attr_bytes = attr_bytes[2:]
packet = (
bytes(20)
+ b"\x1a"
+ vsa_length
+ vendor_id
+ attr_type
+ attr_len
+ attr_bytes
bytes(20) + b"\x1a" + vsa_length + vendor_id + attr_type + attr_len + attr_bytes
)
return packet
@@ -268,9 +260,7 @@ def test_password(plaintext, obfuscated, authenticator):
assert len(decoded) == len(plaintext)
assert decoded == plaintext
assert utils.validate_pap_password(
SECRET, authenticator, encoded, plaintext
)
assert utils.validate_pap_password(SECRET, authenticator, encoded, plaintext)
@pytest.mark.parametrize(