Revert "tests: add unit tests for flavored scopes"

This reverts commit 6f0566581e.
This commit is contained in:
Yacine Elhamer
2023-07-01 01:39:54 +01:00
parent ae5f2ec104
commit d2ff0af34a

View File

@@ -376,47 +376,25 @@ def test_subscope_rules():
""" """
) )
), ),
capa.rules.Rule.from_yaml(
textwrap.dedent(
"""
rule:
meta:
name: test subscopes for scope flavors
scope:
static: function
dynamic: process
features:
- and:
- string: yo
- instruction:
- mnemonic: shr
- number: 5
"""
)
),
] ]
) )
# the file rule scope will have two rules: # the file rule scope will have two rules:
# - `test function subscope` and `test process subscope` # - `test function subscope` and `test process subscope`
assert len(rules.file_rules) == 2 assert len(rules.file_rules) == 2
# the function rule scope have two rule: # the function rule scope have one rule:
# - the rule on which `test function subscope` depends, and # - the rule on which `test function subscope` depends
# the `test subscopes for scope flavors` rule assert len(rules.function_rules) == 1
assert len(rules.function_rules) == 2
# the process rule scope has three rules: # the process rule scope has one rule:
# - the rule on which `test process subscope` depends, # - the rule on which `test process subscope` and depends
# `test thread scope` , and `test subscopes for scope flavors` # as well as `test thread scope`
assert len(rules.process_rules) == 3 assert len(rules.process_rules) == 2
# the thread rule scope has one rule: # the thread rule scope has one rule:
# - the rule on which `test thread subscope` depends # - the rule on which `test thread subscope` depends
assert len(rules.thread_rules) == 1 assert len(rules.thread_rules) == 1
# the rule on which `test subscopes for scope flavors` depends
assert len(rules.instruction_rules) == 1
def test_duplicate_rules(): def test_duplicate_rules():
with pytest.raises(capa.rules.InvalidRule): with pytest.raises(capa.rules.InvalidRule):
@@ -521,66 +499,6 @@ def test_invalid_rules():
""" """
) )
) )
with pytest.raises(capa.rules.InvalidRule):
r = capa.rules.Rule.from_yaml(
textwrap.dedent(
"""
rule:
meta:
name: test rule
scope:
static: basic block
behavior: process
features:
- number: 1
"""
)
)
with pytest.raises(capa.rules.InvalidRule):
r = capa.rules.Rule.from_yaml(
textwrap.dedent(
"""
rule:
meta:
name: test rule
scope:
legacy: basic block
dynamic: process
features:
- number: 1
"""
)
)
with pytest.raises(capa.rules.InvalidRule):
r = capa.rules.Rule.from_yaml(
textwrap.dedent(
"""
rule:
meta:
name: test rule
scope:
static: process
dynamic: process
features:
- number: 1
"""
)
)
with pytest.raises(capa.rules.InvalidRule):
r = capa.rules.Rule.from_yaml(
textwrap.dedent(
"""
rule:
meta:
name: test rule
scope:
static: basic block
dynamic: function
features:
- number: 1
"""
)
)
def test_number_symbol(): def test_number_symbol():