From 82df7ca3287e57c4af19449251efa94fbc12fc59 Mon Sep 17 00:00:00 2001 From: Schamper <1254028+Schamper@users.noreply.github.com> Date: Mon, 4 Sep 2023 22:37:10 +0200 Subject: [PATCH] Fix references --- README.md | 2 +- tests/test_basic.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d16349b..3956c1b 100644 --- a/README.md +++ b/README.md @@ -199,7 +199,7 @@ assert a.dumps() == d The API to access enum members and their values is similar to that of the native Enum type in Python 3. Functionally, it's best comparable to the IntEnum type. ### Custom types -You can implement your own types by subclassing `BaseType` or `RawType`, and adding them to your cstruct instance with `addtype(name, type)` +You can implement your own types by subclassing `BaseType` or `RawType`, and adding them to your cstruct instance with `add_type(name, type)` ### Custom definition parsers Don't like the C-like definition syntax? Write your own syntax parser! diff --git a/tests/test_basic.py b/tests/test_basic.py index 3dd4afa..49f22c9 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -39,9 +39,9 @@ def test_type_resolve(cs: cstruct): cs.resolve("fake") assert "Unknown type" in str(excinfo.value) - cs.addtype("ref0", "uint32") + cs.add_type("ref0", "uint32") for i in range(1, 15): # Recursion limit is currently 10 - cs.addtype(f"ref{i}", f"ref{i - 1}") + cs.add_type(f"ref{i}", f"ref{i - 1}") with pytest.raises(ResolveError) as excinfo: cs.resolve("ref14")