Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test__match_list_no_match():
annotation = {
'name': 'a.primitive',
'key': [
'another_value'
'yet_another_value'
]
}
matches = discovery._match(annotation, 'key', 'value')
assert not matches
def test__match_multiple_keys():
annotation = {
'name': 'a.primitive',
'key': 'value'
}
matches = discovery._match(annotation, 'key', ['value', 'another_value'])
assert matches
def test__match_dict():
annotation = {
'name': 'a.primitive',
'key': {
'value': 'subvalue',
'another_value': 'another_subvalue'
}
}
matches = discovery._match(annotation, 'key', 'value')
assert matches
def test__match_no_match():
annotation = {
'name': 'a.primitive',
}
matches = discovery._match(annotation, 'key', 'value')
assert not matches
def test__match_sublevel():
annotation = {
'name': 'a.primitive',
'some': {
'sublevel': {
'key': 'value'
}
}
}
matches = discovery._match(annotation, 'some.sublevel.key', 'value')
assert matches
def test__match_root():
annotation = {
'name': 'a.primitive',
'key': 'value'
}
matches = discovery._match(annotation, 'key', 'value')
assert matches
def test__match_list():
annotation = {
'name': 'a.primitive',
'key': [
'value',
'another_value'
]
}
matches = discovery._match(annotation, 'key', 'value')
assert matches