From 58a1563a9935115ac7444d57433aa892887d1b0f Mon Sep 17 00:00:00 2001 From: jvoisin Date: Fri, 6 Nov 2020 16:05:42 +0100 Subject: [PATCH] Better test of corrupted MSOffice files --- tests/data/malformed_content_types.docx | Bin 4135 -> 4140 bytes tests/test_corrupted_files.py | 5 ++--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/data/malformed_content_types.docx b/tests/data/malformed_content_types.docx index cc5caf3515b228391273bd7f0ec615ab0bad915a..edc026dd29dee32eb9240f8fb681150e12734900 100644 GIT binary patch delta 480 zcmZ3kutq^Vz?+#xgqeYXgCVglEwHWME-;vpfkAYlxKjP>^&NW_9cgV;^t#3P>{6qw ziQ3yfE|V}Z zTDxR>#_S26tGRERc-0^Ja3lVQchB$1>DuPAbgJw5*K&lgUq99R@2=&4zwJ5Gd`^i= z9a=4QY56{{Vv+o_?sk^}>>a_c`3;JWu?XzxUU! zuL0)my0O;+($5KBWM^$Z<`O5=HD}3Zj!*UGQ?DI%oi?#T_5A18by4yB!oK~F1)iTO zb{Aiz%NRIQ^rUi&L%#Z_Hy39-X;YN)c6zk8^|7Ygk7I^zF5Ibo?vk4Ao?>P(#yoAY z-0F4S{k@WtPA=J+8>gn)f6c;slK$k0Oj4U?GOFyDN8io!9GChrGBEJ5GB5~Fe#k3Uzcp~T-(drhxhKP2 z;sPHXIv}9>mZA9Nfxe#N%TY)8f9_iNw|bqY6z8u1*V~$%=XO4yTD0wA?yW}mRNtd= zpE$kKFE6RNZFOLZL9=Ld>jSQHf$JQ&&#Yy3_DJ3<)@b*4lC`4!QK27?Q$8J8YRc$y z!s$xFUXMiWZQqtjm>8{HvOS}I_5{z>+_z1<4t=;0`=hw$_hfPH>$7yK>-pDmgs_L7 z>iu_D^S|HroLP6Kt~Y53H(heRwsnWo(U#)1lk6w$G5$JV;^qb0|EbmfEYtK__=^{M zHt!eiv6(dCV}144($@>~_@sBOS$J-a`XYX=Z@ry+6htgNp9?+_H=la#aOAX!6{-Q} zFTbvfjOQ2be=P9)RI$7GDqY6FnW`t1TO9J;KfSpy<4K#Ml(*BP#jS@m-F_T1baUZO z<#U(R{O$S7EXJ6pEtlK9&bz-?a?+9~7loI5e&U_{n@ei*JVq5BUX<{je4f`toWb=L zz1|R?cm!r|` diff --git a/tests/test_corrupted_files.py b/tests/test_corrupted_files.py index d4b40a5..8a8cffe 100644 --- a/tests/test_corrupted_files.py +++ b/tests/test_corrupted_files.py @@ -89,9 +89,8 @@ class TestExplicitelyUnsupportedFiles(unittest.TestCase): class TestWrongContentTypesFileOffice(unittest.TestCase): def test_office_incomplete(self): shutil.copy('./tests/data/malformed_content_types.docx', './tests/data/clean.docx') - p = office.MSOfficeParser('./tests/data/clean.docx') - self.assertIsNotNone(p) - self.assertFalse(p.remove_all()) + with self.assertRaises(ValueError): + office.MSOfficeParser('./tests/data/clean.docx') os.remove('./tests/data/clean.docx') def test_office_broken(self):