def apply(self, recordset): items2=recordset.get_records() limit=recordset.get_size() if self.limit is not None: limit = self.limit mrs=MyRecordSet() mrs.set_records(items2[:limit]) return mrs
def apply(self, recordset): items2 = recordset.get_records() limit = recordset.get_size() if self.limit is not None: limit = self.limit mrs = MyRecordSet() mrs.set_records(items2[:limit]) return mrs
def test1(self): mrs = MyRecordSet() item = {'count': 3} mrs.set_items([item, item, item]) args = TestArgs() instance = FilterCountId(args) instance.get_count_id() instance.get_count_id_ints() instance.apply(mrs)
def test1(self): mrs = MyRecordSet() item = {'comment': 'CANCELLED'} mrs.set_items([item, item, item]) args = TestArgs() instance = FilterMax(args) v = instance.get_limit() self.assertEqual(2, v) instance.apply(mrs)
def test1(self): mrs = MyRecordSet() item={'count': 3} mrs.set_items([item,item,item]) args=TestArgs() instance = FilterCountId(args) instance.get_count_id() instance.get_count_id_ints() instance.apply(mrs)
def test1(self): mrs = MyRecordSet() item={'comment': 'CANCELLED'} mrs.set_items([item,item,item]) args=TestArgs() instance = FilterMax(args) v=instance.get_limit() self.assertEqual(2, v) instance.apply(mrs)
def apply(self, recordset): items2 = recordset.get_records() if self.get_count_id() is not None: mrs = MyRecordSet() recs = [] for i in items2: if i.get_item()['count'] in self.get_count_id_ints(): recs.append(i) mrs.set_records(recs) return mrs else: return recordset
def test2(self): class TestArgs2(object): def __init__(self): self.__dict__['count_id'] = None mrs = MyRecordSet() item={'count': 3} mrs.set_items([item,item,item]) args=TestArgs2() instance = FilterCountId(args) instance.get_count_id() # instance.get_count_id_ints() instance.apply(mrs)
def apply(self, mrs): new_recs = [] for rec in mrs.get_records(): add_it = True if 'CANCELLED' in rec.get_item()['comment']: add_it = False # print(add_it) if add_it: new_recs.append(rec) new_mrs=MyRecordSet() new_mrs.set_records(new_recs) return new_mrs
def test2(self): class TestArgs2(object): def __init__(self): self.__dict__['count_id'] = None mrs = MyRecordSet() item = {'count': 3} mrs.set_items([item, item, item]) args = TestArgs2() instance = FilterCountId(args) instance.get_count_id() # instance.get_count_id_ints() instance.apply(mrs)
def test1(self): instance = MyRecordSet() print(instance) item={'bcpao_acc': '2733237', 'bcpao_item': {'address': '2243 ROYAL POINCIANA BLVD , MELBOURNE 32935', 'frame code': '03', 'latest market value total': '$108,250', 'total base area': u'1,812', 'use code': {'use_code': '110', 'use_code_str': None}, 'year built': '1995', 'zip_code': '32935'}, 'case_number': u'05-2008-CA-013830-XXXX-XX', 'case_title': u'COUNTRYWIDE VS NOEL C GABBERT', 'comment': '', 'count': 1, 'foreclosure_sale_date': u'06/18/2014', 'legal': {'blk': u'D', 'lt': u'60', 'pb': u'38', 'pg': u'19', 'subd': u'LANSING RIDGE SUBD PHASE TWO', 'subid': u'12'}} instance.set_items([MyRecord(item)]) instance.pprint() instance.get_size() instance.get_records() instance.set_records(instance.get_records())
def test2(self): mrs = MyRecordSet() item={'comment': ''} mrs.set_items([item]) instance = FilterCancelled(None) instance.apply(mrs)
def test1(self): instance = MyRecordSet() print(instance) item = { 'bcpao_acc': '2733237', 'bcpao_item': { 'address': '2243 ROYAL POINCIANA BLVD , MELBOURNE 32935', 'frame code': '03', 'latest market value total': '$108,250', 'total base area': u'1,812', 'use code': { 'use_code': '110', 'use_code_str': None }, 'year built': '1995', 'zip_code': '32935' }, 'case_number': u'05-2008-CA-013830-XXXX-XX', 'case_title': u'COUNTRYWIDE VS NOEL C GABBERT', 'comment': '', 'count': 1, 'foreclosure_sale_date': u'06/18/2014', 'legal': { 'blk': u'D', 'lt': u'60', 'pb': u'38', 'pg': u'19', 'subd': u'LANSING RIDGE SUBD PHASE TWO', 'subid': u'12' } } instance.set_items([MyRecord(item)]) instance.pprint() instance.get_size() instance.get_records() instance.set_records(instance.get_records())