def dao(self, mock_container):
     """
     In-memory table that has three documents pre-assigned:
         {'char': 'a', 'is_a': True},
         {'char': 'b', 'is_a': False},
         {'char': 'c', 'is_a': False}
     """
     dao = TinyDbDao(mock_container, table_name='table_name')
     dao.batch_insert([{'char': c, 'is_a': c == 'a'} for c in 'abc'])
     return dao
Beispiel #2
0
 def dao(self, mock_container):
     """
     In-memory table that has three documents pre-assigned:
         {'char': 'a', 'is_a': True},
         {'char': 'b', 'is_a': False},
         {'char': 'c', 'is_a': False}
     """
     dao = TinyDbDao(mock_container, table_name="table_name")
     dao.batch_insert([{"char": c, "is_a": c == "a"} for c in "abc"])
     return dao
Beispiel #3
0
 def dao(self, mock_container):
     """
     In-memory table that has three documents pre-assigned:
         {'char': 'a', 'is_a': True},
         {'char': 'b', 'is_a': False},
         {'char': 'c', 'is_a': False}
     """
     dao = TinyDbDao(mock_container, table_name='table_name')
     dao.batch_insert([
         {'char': c, 'is_a': c == 'a'}
         for c in 'abc'
     ])
     return dao
Beispiel #4
0
 def test_batch_insert(self, dao: TinyDbDao):
     batch = [{'foo': 'bar'}, {'foo': 'baz'}]
     result = dao.batch_insert(batch)
     assert result == (4, 5)
     assert list(dao.filter(where('foo').exists())) == batch
 def test_batch_insert(self, dao: TinyDbDao):
     batch = [{'foo': 'bar'}, {'foo': 'baz'}]
     result = dao.batch_insert(batch)
     assert result == (4, 5)
     assert list(dao.filter(where('foo').exists())) == batch
Beispiel #6
0
 def test_batch_insert(self, dao: TinyDbDao):
     batch = [{"foo": "bar"}, {"foo": "baz"}]
     result = dao.batch_insert(batch)
     assert result == (4, 5)
     assert list(dao.filter(where("foo").exists())) == batch