summaryrefslogtreecommitdiffstats
path: root/python/tests
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-07-13 07:31:52 (GMT)
committerThomas Haller <thaller@redhat.com>2023-07-25 11:32:12 (GMT)
commit3c753e3c94b01c63bf99b2709f4780e2df4608eb (patch)
tree4df3d17886d2499363795724d01d5655ce409f66 /python/tests
parent298ee58e7a843d42bfb9edd27de40c93a366f9f7 (diff)
downloadlibnl-3c753e3c94b01c63bf99b2709f4780e2df4608eb.zip
libnl-3c753e3c94b01c63bf99b2709f4780e2df4608eb.tar.gz
libnl-3c753e3c94b01c63bf99b2709f4780e2df4608eb.tar.bz2
python: reformat all Python files with python-black
Automated code formatting is great. Use python-black for that ([1]). Black us not configurable much (uncompromising) and follows PEP8. It thus generates quite a standard, pleasing format. But the point isn't whether the formatting is always the most subjectively pleasing. The point is that the style is generated and enforceable by an automated tool. It takes away places for nit picking, while resulting in a more consistent code base. As this reformats the entire code base, it introduces a large diff and interferes with tools like git-blame. That will be somewhat alleviated by adding a "blame.ignoreRevsFile" for git in the next commit. The change is done automatically, by running python-black version black-22.8.0-2.fc38.noarch: $ black . The result is the same as $ ( git grep -l '#!.*\(PYTHON\|python\)' ; git ls-files '*.py' '*.py.in' ) \ | sort -u \ | xargs -d '\n' black Note that the exact result depends on the version of black. Currently that version is black==22.12.0 from pip. Yes, this means when we bump the version in the future, some reformatting will happen. [1] https://github.com/psf/black
Diffstat (limited to 'python/tests')
-rw-r--r--python/tests/test-create-bridge.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/python/tests/test-create-bridge.py b/python/tests/test-create-bridge.py
index 3b91556..bfb1459 100644
--- a/python/tests/test-create-bridge.py
+++ b/python/tests/test-create-bridge.py
@@ -8,22 +8,22 @@ sock = netlink.lookup_socket(netlink.NETLINK_ROUTE)
cache = link.LinkCache()
cache.refill(sock)
-testtap1 = cache['testtap1']
+testtap1 = cache["testtap1"]
print(testtap1)
lbr = link.Link()
-lbr.type = 'bridge'
-lbr.name = 'testbridge'
+lbr.type = "bridge"
+lbr.name = "testbridge"
print(lbr)
lbr.add()
cache.refill(sock)
-lbr = cache['testbridge']
+lbr = cache["testbridge"]
print(lbr)
lbr.enslave(testtap1)
cache.refill(sock)
-testtap1 = cache['testtap1']
+testtap1 = cache["testtap1"]
print(capi.rtnl_link_is_bridge(lbr._rtnl_link))
print(capi.rtnl_link_get_master(testtap1._rtnl_link))