def test_parse_record(pvname, expected_tuple): parsed = ca.parse_record_field(pvname) print('parsed: ', tuple(parsed)) print('expected:', expected_tuple) assert tuple(parsed) == expected_tuple if parsed.modifiers: modifiers, filter_text = parsed.modifiers if filter_text: # smoke test these ca.parse_channel_filter(filter_text)
def test_parse_record_bad_filters(pvname, expected_tuple): parsed = ca.parse_record_field(pvname) print('parsed: ', tuple(parsed)) print('expected:', expected_tuple) assert tuple(parsed) == expected_tuple modifiers, filter_text = parsed.modifiers try: filter_ = ca.parse_channel_filter(filter_text) except ValueError: # expected failure ... else: raise ValueError(f'Expected failure, instead returned {filter_}')