示例#1
0
    def test_query(self):
        # test with not connected
        grn = Groonga()
        self.assertRaises(GroongaError, grn.query, 'a')

        # test with invalid command
        grn = Groonga()
        grn.connect('localhost', 10041)
        self.assertRaises(GroongaError, grn.query, 'a')

        # test the query
        grn = Groonga()
        grn.connect('localhost', 10041)
        result = grn.query('table_list')
        self.assertEqual(result, '''[[["id","UInt32"],["name","ShortText"],\
["path","ShortText"],["flags","ShortText"],["domain","ShortText"],\
["range","ShortText"]]]''')

        # test the query with after the query of invalid command
        grn = Groonga()
        grn.connect('localhost', 10041)
        self.assertRaises(GroongaError, grn.query, 'unknown command')
        result = grn.query('table_list')
        self.assertEqual(result, '''[[["id","UInt32"],["name","ShortText"],\
["path","ShortText"],["flags","ShortText"],["domain","ShortText"],\
["range","ShortText"]]]''')
示例#2
0
 def test_query_with_after_invalid_command(self):
     grn = Groonga()
     grn.connect()
     with pytest.raises(GroongaError):
         grn.query('unknown command')
     result = grn.query('cache_limit')
     assert result == '100'
示例#3
0
 def test_query_with_invalid_command(self):
     grn = Groonga()
     grn.connect()
     with pytest.raises(GroongaError):
         grn.query('a')
示例#4
0
 def test_query(self):
     grn = Groonga()
     grn.connect()
     result = grn.query('cache_limit')
     assert result == '100'
示例#5
0
 def test_query_with_not_connected(self):
     grn = Groonga()
     with pytest.raises(GroongaError):
         grn.query('a')