Lint headway
This commit is contained in:
parent
32035a005e
commit
29aaea1a45
4 changed files with 18 additions and 17 deletions
|
@ -3,10 +3,10 @@ import pytest
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("num", [
|
@pytest.mark.parametrize("num", [
|
||||||
"0", # 0 itself is the start Damm state
|
"0", # 0 itself is the start Damm state
|
||||||
"37", # [0, 3] => 7
|
"37", # [0, 3] => 7
|
||||||
"92", # [0, 9] => 2
|
"92", # [0, 9] => 2
|
||||||
"1234", # Amusingly, this is a 0-product.
|
"1234", # Amusingly, this is a 0-product.
|
||||||
])
|
])
|
||||||
def test_num_verifies(num):
|
def test_num_verifies(num):
|
||||||
"""Assert that known-good Damm checks pass."""
|
"""Assert that known-good Damm checks pass."""
|
||||||
|
|
|
@ -5,25 +5,25 @@ from hypothesis.strategies import integers
|
||||||
import proquint
|
import proquint
|
||||||
|
|
||||||
|
|
||||||
@given(integers(min_value=0, max_value=1 << 16))
|
@given(integers(min_value=0, max_value=1<<16))
|
||||||
def test_round_trip_16(val):
|
def test_round_trip_16(val):
|
||||||
assert proquint.Proquint.decode(
|
assert proquint.Proquint.decode(
|
||||||
proquint.Proquint.encode(val, 16)) == val
|
proquint.Proquint.encode(val, 16)) == val
|
||||||
|
|
||||||
|
|
||||||
@given(integers(min_value=0, max_value=1 << 32))
|
@given(integers(min_value=0, max_value=1<<32))
|
||||||
def test_round_trip_32(val):
|
def test_round_trip_32(val):
|
||||||
assert proquint.Proquint.decode(
|
assert proquint.Proquint.decode(
|
||||||
proquint.Proquint.encode(val, 32)) == val
|
proquint.Proquint.encode(val, 32)) == val
|
||||||
|
|
||||||
|
|
||||||
@given(integers(min_value=0, max_value=1 << 64))
|
@given(integers(min_value=0, max_value=1<<64))
|
||||||
def test_round_trip_64(val):
|
def test_round_trip_64(val):
|
||||||
assert proquint.Proquint.decode(
|
assert proquint.Proquint.decode(
|
||||||
proquint.Proquint.encode(val, 64)) == val
|
proquint.Proquint.encode(val, 64)) == val
|
||||||
|
|
||||||
|
|
||||||
@given(integers(min_value=0, max_value=1 << 512))
|
@given(integers(min_value=0, max_value=1<<512))
|
||||||
def test_round_trip_512(val):
|
def test_round_trip_512(val):
|
||||||
assert proquint.Proquint.decode(
|
assert proquint.Proquint.decode(
|
||||||
proquint.Proquint.encode(val, 512)) == val
|
proquint.Proquint.encode(val, 512)) == val
|
||||||
|
|
|
@ -14,11 +14,11 @@ import yaml
|
||||||
|
|
||||||
|
|
||||||
RECORD_LINE_PATTERN = re.compile(
|
RECORD_LINE_PATTERN = re.compile(
|
||||||
"^(?P<rrset_name>\S+)\s+"
|
r"^(?P<rrset_name>\S+)\s+"
|
||||||
"(?P<rrset_ttl>\S+)\s+"
|
r"(?P<rrset_ttl>\S+)\s+"
|
||||||
"IN\s+"
|
r"IN\s+"
|
||||||
"(?P<rrset_type>\S+)\s+"
|
r"(?P<rrset_type>\S+)\s+"
|
||||||
"(?P<rrset_values>.+)$"
|
r"(?P<rrset_values>.+)$"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ SHITLIST = [
|
||||||
"setuptools",
|
"setuptools",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def req_name(requirement: str) -> str:
|
def req_name(requirement: str) -> str:
|
||||||
requirement = requirement.lower()
|
requirement = requirement.lower()
|
||||||
match = re.match(REQ_PATTERN, requirement)
|
match = re.match(REQ_PATTERN, requirement)
|
||||||
|
@ -58,9 +59,9 @@ def _bq(query):
|
||||||
"""Enumerate the PyPi package names from a Bazel query."""
|
"""Enumerate the PyPi package names from a Bazel query."""
|
||||||
|
|
||||||
unused = subprocess.check_output(["bazel", "query", query, "--output=package"]).decode("utf-8")
|
unused = subprocess.check_output(["bazel", "query", query, "--output=package"]).decode("utf-8")
|
||||||
for l in unused.split("\n"):
|
for line in unused.split("\n"):
|
||||||
if l:
|
if line:
|
||||||
yield l.replace("@arrdem_source_pypi//pypi__", "")
|
yield line.replace("@arrdem_source_pypi//pypi__", "")
|
||||||
|
|
||||||
|
|
||||||
def _unused():
|
def _unused():
|
||||||
|
@ -75,7 +76,7 @@ def _load(fname):
|
||||||
with open(fname, "r") as reqfile:
|
with open(fname, "r") as reqfile:
|
||||||
# FIXME (arrdem 2021-08-03):
|
# FIXME (arrdem 2021-08-03):
|
||||||
# Return a parse, not just lines.
|
# Return a parse, not just lines.
|
||||||
return list(l.strip() for l in reqfile)
|
return list(line.strip() for line in reqfile)
|
||||||
|
|
||||||
|
|
||||||
def _write(fname, reqs):
|
def _write(fname, reqs):
|
||||||
|
|
Loading…
Reference in a new issue