summaryrefslogtreecommitdiff
path: root/python/test_xrelfo.py
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2022-10-28 10:59:41 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2022-10-28 11:01:22 +0100
commit00f0c39903653772d72c9c0adce661508138c0b0 (patch)
treea5d3c0536c2edf4bb8ae314b7ae07bfc223597d8 /python/test_xrelfo.py
parent3727be24a032e0577d19ccf5ad995059f7cf6d68 (diff)
python: apply black formatting
The python/ directory hasn't been shoved into black yet (unlike topotests, where most FRR python code is.) Run black over it. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'python/test_xrelfo.py')
-rw-r--r--python/test_xrelfo.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/python/test_xrelfo.py b/python/test_xrelfo.py
index 3ae24ea7b3..3379959dc1 100644
--- a/python/test_xrelfo.py
+++ b/python/test_xrelfo.py
@@ -22,20 +22,21 @@ import pytest
from pprint import pprint
root = os.path.dirname(os.path.dirname(__file__))
-sys.path.append(os.path.join(root, 'python'))
+sys.path.append(os.path.join(root, "python"))
import xrelfo
from clippy import elf, uidhash
+
def test_uidhash():
- assert uidhash.uidhash("lib/test_xref.c", "logging call", 3, 0) \
- == 'H7KJB-67TBH'
+ assert uidhash.uidhash("lib/test_xref.c", "logging call", 3, 0) == "H7KJB-67TBH"
+
def test_xrelfo_other():
for data in [
- elf.ELFNull(),
- elf.ELFUnresolved('somesym', 0),
- ]:
+ elf.ELFNull(),
+ elf.ELFUnresolved("somesym", 0),
+ ]:
dissect = xrelfo.XrefPtr(data)
print(repr(dissect))
@@ -43,9 +44,10 @@ def test_xrelfo_other():
with pytest.raises(AttributeError):
dissect.xref
+
def test_xrelfo_obj():
xrelfo_ = xrelfo.Xrelfo()
- edf = xrelfo_.load_elf(os.path.join(root, 'lib/.libs/zclient.o'), 'zclient.lo')
+ edf = xrelfo_.load_elf(os.path.join(root, "lib/.libs/zclient.o"), "zclient.lo")
xrefs = xrelfo_._xrefs
with pytest.raises(elf.ELFAccessError):
@@ -54,12 +56,13 @@ def test_xrelfo_obj():
pprint(xrefs[0])
pprint(xrefs[0]._data)
+
def test_xrelfo_bin():
xrelfo_ = xrelfo.Xrelfo()
- edf = xrelfo_.load_elf(os.path.join(root, 'lib/.libs/libfrr.so'), 'libfrr.la')
+ edf = xrelfo_.load_elf(os.path.join(root, "lib/.libs/libfrr.so"), "libfrr.la")
xrefs = xrelfo_._xrefs
- assert edf[0:4] == b'\x7fELF'
+ assert edf[0:4] == b"\x7fELF"
pprint(xrefs[0])
pprint(xrefs[0]._data)