Permalink
Browse files

add test data to repo, nicer tests

  • Loading branch information...
1 parent 281418c commit 3d93d60857124c04d9f63b99db54d08bfca90887 @shamrin committed Apr 6, 2012
Showing with 8 additions and 7 deletions.
  1. +8 −7 olefield.py
  2. BIN test/dib
  3. BIN test/master.bmp
  4. BIN test/paintbrush
View
@@ -201,13 +201,14 @@ def unwrap(binary, spec, data_name=None):
return length, dict(zip(names, values))
-if __name__ == '__main__':
- paint = open('paintbrush_picture_big_boy').read()
- dib = open('dib_picture_big_boy').read()
-
- for olefield in (dib, paint):
+if __name__ == '__main__': # tests
+ master = open('test/master.bmp').read()
+ for filename in ['test/paintbrush', 'test/dib']:
+ print '%s:' % filename
+ olefield = open(filename, 'rb').read()
for object_type, data in parse_olefield(olefield):
- print object_type, sformat(data)
+ print '\t- object %r %d bytes' % (object_type, len(data))
if object_type == 'METAFILEPICT':
for image in parse_metafile(data):
- print 'image', sformat(image)
+ assert master == image
+ print '\t\t* BMP image %d bytes: ok' % len(image)
View
BIN test/dib
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.

0 comments on commit 3d93d60

Please sign in to comment.