testcustom.py
1 """ 2 Custom database tests 3 """ 4 5 import unittest 6 7 from txtai.database import DatabaseFactory 8 9 10 class TestCustom(unittest.TestCase): 11 """ 12 Custom database backend tests. 13 """ 14 15 def testCustomBackend(self): 16 """ 17 Test resolving a custom backend 18 """ 19 20 database = DatabaseFactory.create({"content": "txtai.database.SQLite"}) 21 self.assertIsNotNone(database) 22 23 def testCustomBackendNotFound(self): 24 """ 25 Test resolving an unresolvable backend 26 """ 27 28 with self.assertRaises(ImportError): 29 DatabaseFactory.create({"content": "notfound.database"})