async def test_scan_with_projection_only(client: Client, table: TableName): item1 = {"h": "h", "r": "1", "d": "x"} item2 = {"h": "h", "r": "2", "d": "y"} await client.put_item(table, item1) await client.put_item(table, item2) items = [item async for item in client.scan(table, projection=F("d"))] assert items == [{"d": "x"}, {"d": "y"}]
async def test_scan_with_limit(client: Client, table: TableName): item1 = {"h": "h", "r": "1", "d": "x"} item2 = {"h": "h", "r": "2", "d": "y"} await client.put_item(table, item1) await client.put_item(table, item2) items = [item async for item in client.scan(table, limit=1)] assert len(items) == 1 assert items[0] == item1
async def test_scan(client: Client, table: TableName): item1 = {"h": "h", "r": "1", "d": "x"} item2 = {"h": "h", "r": "2", "d": "y"} items = [item1, item2] await client.put_item(table, item1) await client.put_item(table, item2) index = 0 async for item in client.scan(table): assert item == items[index] index += 1 assert index == 2