def _test_valid(self, type_, not_type, file): meta = mediainfo.get_metadata(file, **self.query) self.assert_(meta["General"][type_ + "Count"]) self.assert_(meta["General"][not_type + "Count"] == 0) missing_keys = [] for attr, attrtype in self.query[type_].iteritems(): if meta[type_][attr] is None: missing_keys.append(attr) else: self.assertEqual(type(meta[type_][attr]), type(attrtype())) self.assert_(not_type not in meta) if missing_keys: self.fail("Missing keys: %r" % missing_keys)
def _test_invalid(self, file): meta = mediainfo.get_metadata(file, **self.query) self.assert_(meta["General"]["VideoCount"] == 0) self.assert_(meta["General"]["ImageCount"] == 0) for section in ["Video", "Image"]: self.assert_(section not in meta)