change app.count to app.db.count (#620)

This commit is contained in:
David Talson
2023-09-14 22:39:57 -04:00
committed by GitHub
parent b1af82eba8
commit a662b2a6c6

View File

@@ -172,21 +172,21 @@ class TestChromaDbCollection(unittest.TestCase):
app = App(config=AppConfig(collect_metrics=False))
app.set_collection_name("test_collection_1")
# Collection should be empty when created
self.assertEqual(app.count(), 0)
self.assertEqual(app.db.count(), 0)
app.db.collection.add(embeddings=[0, 0, 0], ids=["0"])
# After adding, should contain one item
self.assertEqual(app.count(), 1)
self.assertEqual(app.db.count(), 1)
app.set_collection_name("test_collection_2")
# New collection is empty
self.assertEqual(app.count(), 0)
self.assertEqual(app.db.count(), 0)
# Adding to new collection should not effect existing collection
app.db.collection.add(embeddings=[0, 0, 0], ids=["0"])
app.set_collection_name("test_collection_1")
# Should still be 1, not 2.
self.assertEqual(app.count(), 1)
self.assertEqual(app.db.count(), 1)
def test_collections_are_persistent(self):
"""
@@ -202,7 +202,7 @@ class TestChromaDbCollection(unittest.TestCase):
app = App(config=AppConfig(collect_metrics=False))
app.set_collection_name("test_collection_1")
self.assertEqual(app.count(), 1)
self.assertEqual(app.db.count(), 1)
def test_parallel_collections(self):
"""