def testYieldFromListWithAttributes(self): self.mocked_client.columnalternate.List.Expect( fusiontables.FusiontablesColumnListAlternateRequest( pageSize=100, pageToken=None, tableId='mytable', ), fusiontables.ColumnListAlternate( columns=[ fusiontables.Column(name='c0'), fusiontables.Column(name='c1'), ], nextPageToken='x', )) self.mocked_client.columnalternate.List.Expect( fusiontables.FusiontablesColumnListAlternateRequest( pageSize=100, pageToken='x', tableId='mytable', ), fusiontables.ColumnListAlternate(columns=[ fusiontables.Column(name='c2'), ], )) client = fusiontables.FusiontablesV1(get_credentials=False) request = fusiontables.FusiontablesColumnListAlternateRequest( tableId='mytable') results = list_pager.YieldFromList(client.columnalternate, request, batch_size_attribute='pageSize', field='columns') self._AssertInstanceSequence(results, 3)
def testYieldFromListWithPredicate(self): self.mocked_client.column.List.Expect( fusiontables.FusiontablesColumnListRequest( maxResults=100, pageToken=None, tableId='mytable', ), fusiontables.ColumnList( items=[ fusiontables.Column(name='c0'), fusiontables.Column(name='bad0'), fusiontables.Column(name='c1'), fusiontables.Column(name='bad1'), ], nextPageToken='x', )) self.mocked_client.column.List.Expect( fusiontables.FusiontablesColumnListRequest( maxResults=100, pageToken='x', tableId='mytable', ), fusiontables.ColumnList(items=[ fusiontables.Column(name='c2'), ], )) client = fusiontables.FusiontablesV1(get_credentials=False) request = fusiontables.FusiontablesColumnListRequest(tableId='mytable') results = list_pager.YieldFromList(client.column, request, predicate=lambda x: 'c' in x.name) self._AssertInstanceSequence(results, 3)
def testYieldFromListPartial(self): self.mocked_client.column.List.Expect( fusiontables.FusiontablesColumnListRequest( maxResults=100, pageToken=None, tableId='mytable', ), fusiontables.ColumnList( items=[ fusiontables.Column(name='c0'), fusiontables.Column(name='c1'), fusiontables.Column(name='c2'), fusiontables.Column(name='c3'), ], nextPageToken='x', )) self.mocked_client.column.List.Expect( fusiontables.FusiontablesColumnListRequest( maxResults=100, pageToken='x', tableId='mytable', ), fusiontables.ColumnList(items=[ fusiontables.Column(name='c4'), fusiontables.Column(name='c5'), fusiontables.Column(name='c6'), fusiontables.Column(name='c7'), ], )) client = fusiontables.FusiontablesV1(get_credentials=False) request = fusiontables.FusiontablesColumnListRequest(tableId='mytable') results = list_pager.YieldFromList(client.column, request, limit=6) self._AssertInstanceSequence(results, 6)