#NEWLINE# def having( self , aggregations , test ) : #NEWLINE# #INDENT# '\n    Create a new :class:`.TableSet` with only those tables that pass a test.\n\n    This works by applying a sequence of :class:`Aggregation` instances to\n    each table. The resulting dictionary of properties is then passed to\n    the :code:`test` function.\n\n    This method does not modify the underlying tables in any way.\n\n    :param aggregations:\n        A list of tuples in the format :code:`(name, aggregation)`, where\n        each :code:`aggregation` is an instance of :class:`.Aggregation`.\n    :param test:\n        A function that takes a dictionary of aggregated properties and returns\n        :code:`True` if it should be included in the new :class:`.TableSet`.\n    :type test:\n        :class:`function`\n    :returns:\n        A new :class:`.TableSet`.\n    ' #NEWLINE# new_tables = [ ] #NEWLINE# new_keys = [ ] #NEWLINE# for ( key , table ) in self . items ( ) : #NEWLINE# #INDENT# props = table . aggregate ( aggregations ) #NEWLINE# if test ( props ) : #NEWLINE# #INDENT# new_tables . append ( table ) #NEWLINE# new_keys . append ( key ) #NEWLINE# #UNINDENT# #UNINDENT# return self . _fork ( new_tables , new_keys )