def test__with_invalid_group(): args = { 'data': 'hello world\nthis is a regex test named "sanity". please consider test named "sanity2".', 'regex': 'test.*"(.*?)"', 'group': 'not a number', } with pytest.raises(ValueError): main(args)
def test__with_unicode(): args = { 'data': 'hello world\nthis is a regex test named "sanity". please consider test named "שלום".', 'regex': 'test.*"(.*?)"', } results = main(args) assert not results.outputs assert 'test named "sanity"' in results.raw_response assert 'test named "שלום"' in results.raw_response
def test__multiple_with_group(): args = { 'data': 'hello world\nthis is a regex test named "sanity".\nplease consider test named "sanity2".\n', 'regex': 'test.*"(.*?)".$', 'group': '1', } results = main(args) assert not results.outputs assert 'sanity' in results.raw_response assert 'sanity2' in results.raw_response