Ticket #993: patch-993.diff

File patch-993.diff, 1.2 kB (added by konrads, 1 year ago)
  • test/test_reprs.py

    old new  
    99from axiom.attributes import integer, text, reference 
    1010from axiom.item import Item 
    1111from axiom.store import Store 
    12  
    1312from twisted.trial.unittest import TestCase 
    1413 
    1514class ReprTesterItemClass(Item): 
     
    107106        R = repr(i1) 
    108107        self.assertIn("reference(unstored@%d)" % (id(i2),), R) 
    109108 
    110  
     109    def test_itemWithNoStoreReps(self): 
     110        """ 
     111        Verify, that items that are instantiated without a C{axiom.store.Store)  
     112        __repr__ correctly 
     113        """ 
     114        import re 
     115        class Y(Item): 
     116          y = text() 
     117         
     118        self.assertTrue(re.match('^Y\(y=None, storeID=None\)',Y().__repr__())) 
  • attributes.py

    old new  
    420420            return self 
    421421 
    422422        pyval = getattr(oself, self.underlying, _NEEDS_FETCH) 
    423         st = getattr(oself, 'store') 
    424423        if pyval is _NEEDS_FETCH: 
    425424            dbval = getattr(oself, self.dbunderlying, _NEEDS_FETCH) 
    426425            if dbval is _NEEDS_FETCH: 
jethro@divmod.org