Skip to content

Commit

Permalink
Simplify a test in blob_packing
Browse files Browse the repository at this point in the history
  • Loading branch information
jmuchemb committed Jul 4, 2016
1 parent 7886065 commit d09694f
Showing 1 changed file with 10 additions and 32 deletions.
42 changes: 10 additions & 32 deletions src/ZODB/tests/blob_packing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,41 +31,19 @@ Put some revisions of a blob object in our database and on the filesystem:
>>> import os
>>> tids = []
>>> times = []
>>> nothing = transaction.begin()
>>> times.append(new_time())
>>> blob = Blob()
>>> with blob.open('w') as file:
... _ = file.write(b'this is blob data 0')
>>> root['blob'] = blob
>>> transaction.commit()

>>> nothing = transaction.begin()
>>> times.append(new_time())
>>> with root['blob'].open('w') as file:
... _ = file.write(b'this is blob data 1')
>>> tids.append(blob._p_serial)
>>> transaction.commit()

>>> nothing = transaction.begin()
>>> times.append(new_time())
>>> with root['blob'].open('w') as file:
... _ = file.write(b'this is blob data 2')
>>> tids.append(blob._p_serial)
>>> transaction.commit()

>>> nothing = transaction.begin()
>>> times.append(new_time())
>>> with root['blob'].open('w') as file:
... _ = file.write(b'this is blob data 3')
>>> tids.append(blob._p_serial)
>>> transaction.commit()
>>> for i in range(5):
... _ = transaction.begin()
... times.append(new_time())
... with blob.open('w') as file:
... _ = file.write(b'this is blob data ' + str(i).encode())
... if i:
... tids.append(blob._p_serial)
... else:
... root['blob'] = blob
... transaction.commit()

>>> nothing = transaction.begin()
>>> times.append(new_time())
>>> with root['blob'].open('w') as file:
... _ = file.write(b'this is blob data 4')
>>> tids.append(blob._p_serial)
>>> transaction.commit()
>>> blob._p_activate()
>>> tids.append(blob._p_serial)

Expand Down

0 comments on commit d09694f

Please sign in to comment.