This commit is contained in:
Willi Ballenthin
2023-03-22 10:52:40 +01:00
parent 02fdf41969
commit 4754a84a8a
2 changed files with 11 additions and 5 deletions

View File

@@ -123,8 +123,14 @@ def test_addr_to_pb2():
def test_scope_to_pb2():
assert capa.render.proto.proto.scope_to_pb2(capa.rules.Scope(capa.rules.FILE_SCOPE)) == capa_pb2.SCOPE_FILE
assert capa.render.proto.proto.scope_to_pb2(capa.rules.Scope(capa.rules.FUNCTION_SCOPE)) == capa_pb2.SCOPE_FUNCTION
assert capa.render.proto.proto.scope_to_pb2(capa.rules.Scope(capa.rules.BASIC_BLOCK_SCOPE)) == capa_pb2.SCOPE_BASIC_BLOCK
assert capa.render.proto.proto.scope_to_pb2(capa.rules.Scope(capa.rules.INSTRUCTION_SCOPE)) == capa_pb2.SCOPE_INSTRUCTION
assert (
capa.render.proto.proto.scope_to_pb2(capa.rules.Scope(capa.rules.BASIC_BLOCK_SCOPE))
== capa_pb2.SCOPE_BASIC_BLOCK
)
assert (
capa.render.proto.proto.scope_to_pb2(capa.rules.Scope(capa.rules.INSTRUCTION_SCOPE))
== capa_pb2.SCOPE_INSTRUCTION
)
def cmp_optional(a: Any, b: Any) -> bool:

View File

@@ -6,15 +6,15 @@
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
import copy
import pytest
from fixtures import *
import capa
import capa.engine as ceng
import capa.render.result_document as rdoc
import capa.features.freeze.features as frzf
from fixtures import *
def test_optional_node_from_capa():
node = rdoc.node_from_capa(
@@ -267,4 +267,4 @@ def assert_round_trip(rd: rdoc.ResultDocument):
)
def test_round_trip(request, rd_file):
rd: rdoc.ResultDocument = request.getfixturevalue(rd_file)
assert_round_trip(rd)
assert_round_trip(rd)