def test_filter_with_unclosed_quotation_mark_and_query(self): filters, query = separate_filters_from_query( 'author:"foo bar hello world') self.assertDictEqual(filters, {}) self.assertEqual(query, 'author:"foo bar hello world')
def test_two_filters_and_query(self): filters, query = separate_filters_from_query( 'author:"foo bar" hello world bar:beer') self.assertDictEqual(filters, {'author': 'foo bar', 'bar': 'beer'}) self.assertEqual(query, 'hello world')
def test_filter_and_query(self): filters, query = separate_filters_from_query('author:foo hello world') self.assertDictEqual(filters, {'author': 'foo'}) self.assertEqual(query, 'hello world')
def test_filter_with_quotation_mark(self): filters, query = separate_filters_from_query('author:"foo bar"') self.assertDictEqual(filters, {'author': 'foo bar'}) self.assertEqual(query, '')
def test_filter(self): filters, query = separate_filters_from_query('author:foo') self.assertDictEqual(filters, {'author': 'foo'}) self.assertEqual(query, '')
def test_only_query(self): filters, query = separate_filters_from_query('hello world') self.assertDictEqual(filters, {}) self.assertEqual(query, 'hello world')
def test_filter_with_quotation_mark_and_query(self): filters, query = separate_filters_from_query( 'author:"foo bar" hello world') self.assertDictEqual(filters, {'author': 'foo bar'}) self.assertEquals(query, 'hello world')