Skip to content

Commit 94e394a

Browse files
committed
Merge branch 'kawochen-TST-TestMsgpack-gen'
2 parents d3fed34 + 117ea52 commit 94e394a

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

pandas/io/tests/test_packers.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -532,14 +532,30 @@ class TestMsgpack():
532532
http://stackoverflow.com/questions/6689537/nose-test-generators-inside-class
533533
"""
534534
def setUp(self):
535-
from pandas.io.tests.generate_legacy_storage_files import create_msgpack_data
535+
from pandas.io.tests.generate_legacy_storage_files import (
536+
create_msgpack_data, create_data)
536537
self.data = create_msgpack_data()
538+
self.all_data = create_data()
537539
self.path = u('__%s__.msgpack' % tm.rands(10))
540+
self.minimum_structure = {'series': ['float', 'int', 'mixed', 'ts', 'mi', 'dup'],
541+
'frame': ['float', 'int', 'mixed', 'mi'],
542+
'panel': ['float'],
543+
'index': ['int', 'date', 'period'],
544+
'mi': ['reg2']}
545+
546+
def check_min_structure(self, data):
547+
for typ, v in self.minimum_structure.items():
548+
assert typ in data, '"{0}" not found in unpacked data'.format(typ)
549+
for kind in v:
550+
assert kind in data[typ], '"{0}" not found in data["{1}"]'.format(kind, typ)
538551

539552
def compare(self, vf):
540553
data = read_msgpack(vf)
554+
self.check_min_structure(data)
541555
for typ, dv in data.items():
556+
assert typ in self.all_data, 'unpacked data contains extra key "{0}"'.format(typ)
542557
for dt, result in dv.items():
558+
assert dt in self.all_data[typ], 'data["{0}"] contains extra key "{1}"'.format(typ, dt)
543559
try:
544560
expected = self.data[typ][dt]
545561
except KeyError:

0 commit comments

Comments
 (0)