Remove type_regex testcase

This is leftover testcase for type checker regex removed in
https://github.com/ansible/ansible/pull/82153

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/82164/head
Abhijeet Kasurde 7 months ago committed by Matt Clay
parent 9dd3eafa14
commit 78c16d983e

@ -22,42 +22,3 @@ def validate_modules() -> None:
sys.modules['antsibull_docs_parser'] = antsibull_docs_parser = mock.MagicMock()
sys.modules['antsibull_docs_parser.parser'] = antsibull_docs_parser.parser = mock.MagicMock()
@pytest.mark.parametrize('cstring,cexpected', [
['if type(foo) is Bar', True],
['if Bar is type(foo)', True],
['if type(foo) is not Bar', True],
['if Bar is not type(foo)', True],
['if type(foo) == Bar', True],
['if Bar == type(foo)', True],
['if type(foo)==Bar', True],
['if Bar==type(foo)', True],
['if type(foo) != Bar', True],
['if Bar != type(foo)', True],
['if type(foo)!=Bar', True],
['if Bar!=type(foo)', True],
['if foo or type(bar) != Bar', True],
['x = type(foo)', False],
["error = err.message + ' ' + str(err) + ' - ' + str(type(err))", False],
# cloud/amazon/ec2_group.py
["module.fail_json(msg='Invalid rule parameter type [%s].' % type(rule))", False],
# files/patch.py
["p = type('Params', (), module.params)", False], # files/patch.py
# system/osx_defaults.py
["if self.current_value is not None and not isinstance(self.current_value, type(self.value)):", True],
# system/osx_defaults.py
['raise OSXDefaultsException("Type mismatch. Type in defaults: " + type(self.current_value).__name__)', False],
# network/nxos/nxos_interface.py
["if get_interface_type(interface) == 'svi':", False],
])
def test_type_regex(cstring, cexpected): # type: (str, str) -> None
"""Check TYPE_REGEX against various examples to verify it correctly matches or does not match."""
from validate_modules.main import TYPE_REGEX
match = TYPE_REGEX.match(cstring)
if cexpected:
assert match, f"should have matched: {cstring}"
else:
assert not match, f"should not have matched: {cstring}"

Loading…
Cancel
Save