Applying black formatting

- Fixing flake8 configuration to agree with black
- Adding black validation check to github actions
This commit is contained in:
Jacob Alexander
2021-10-01 11:00:22 -07:00
parent 5dade41aeb
commit 6e7fffd7de
51 changed files with 2536 additions and 1837 deletions

View File

@@ -8,21 +8,21 @@ this_dir = os.path.dirname(__file__)
@pytest.fixture
def addressbook():
return capnp.load(os.path.join(this_dir, 'addressbook.capnp'))
return capnp.load(os.path.join(this_dir, "addressbook.capnp"))
@pytest.fixture
def foo():
return capnp.load(os.path.join(this_dir, 'foo.capnp'))
return capnp.load(os.path.join(this_dir, "foo.capnp"))
@pytest.fixture
def bar():
return capnp.load(os.path.join(this_dir, 'bar.capnp'))
return capnp.load(os.path.join(this_dir, "bar.capnp"))
def test_basic_load():
capnp.load(os.path.join(this_dir, 'addressbook.capnp'))
capnp.load(os.path.join(this_dir, "addressbook.capnp"))
def test_constants(addressbook):
@@ -40,25 +40,25 @@ def test_import(foo, bar):
m2 = capnp._MallocMessageBuilder()
bar = m2.init_root(bar.Bar)
foo.name = 'foo'
foo.name = "foo"
bar.foo = foo
assert bar.foo.name == 'foo'
assert bar.foo.name == "foo"
def test_failed_import():
s = capnp.SchemaParser()
s2 = capnp.SchemaParser()
foo = s.load(os.path.join(this_dir, 'foo.capnp'))
bar = s2.load(os.path.join(this_dir, 'bar.capnp'))
foo = s.load(os.path.join(this_dir, "foo.capnp"))
bar = s2.load(os.path.join(this_dir, "bar.capnp"))
m = capnp._MallocMessageBuilder()
foo = m.init_root(foo.Foo)
m2 = capnp._MallocMessageBuilder()
bar = m2.init_root(bar.Bar)
foo.name = 'foo'
foo.name = "foo"
with pytest.raises(Exception):
bar.foo = foo
@@ -86,6 +86,7 @@ def test_add_import_hook():
capnp.cleanup_global_schema_parser()
import addressbook_capnp
addressbook_capnp.AddressBook.new_message()
@@ -98,6 +99,7 @@ def test_multiple_add_import_hook():
capnp.cleanup_global_schema_parser()
import addressbook_capnp
addressbook_capnp.AddressBook.new_message()
@@ -105,9 +107,9 @@ def test_remove_import_hook():
capnp.add_import_hook([this_dir])
capnp.remove_import_hook()
if 'addressbook_capnp' in sys.modules:
if "addressbook_capnp" in sys.modules:
# hack to deal with it being imported already
del sys.modules['addressbook_capnp']
del sys.modules["addressbook_capnp"]
with pytest.raises(ImportError):
import addressbook_capnp # noqa: F401