def test_invalid_entry(self, mocked_stream): mocked_stream.side_effect = _fake_stream with assert_raises(siglists.BadRegularExpressionLineError) as cm: siglists._get_file_content('test-invalid-sig-list') ok_(cm.exception.message.startswith('Regex error: ')) ok_(cm.exception.message.endswith('at line 3')) ok_('test-invalid-sig-list.txt' in cm.exception.message)
def test_invalid_entry(self, mocked_stream): mocked_stream.side_effect = _fake_stream with pytest.raises(siglists.BadRegularExpressionLineError) as exc_info: siglists._get_file_content('test-invalid-sig-list') msg = exc_info.exconly() assert msg.startswith('BadRegularExpressionLineError: Regex error: ') assert msg.endswith('at line 3') assert 'test-invalid-sig-list.txt' in msg
def test_valid_entries(self, mocked_stream): mocked_stream.side_effect = _fake_stream expected = ( 'fooBarStuff', 'moz::.*', '@0x[0-9a-fA-F]{2,}', ) content = siglists._get_file_content('test-valid-sig-list') eq_(content, expected)