From f23354b29d0e50b7b12622a6839ae2986d0915b8 Mon Sep 17 00:00:00 2001 From: Jano Paetzold Date: Sat, 20 Aug 2022 19:35:55 +0200 Subject: [PATCH 1/9] Test Celtx import Yes, it is broken --- tests/fixtures/test.celtx | Bin 0 -> 32001 bytes tests/test_myimport.py | 13 +++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 tests/fixtures/test.celtx diff --git a/tests/fixtures/test.celtx b/tests/fixtures/test.celtx new file mode 100644 index 0000000000000000000000000000000000000000..06d753d58d22c8895418655d1acbfa0e68c0b768 GIT binary patch literal 32001 zcmeHQOLN;;c2*|cd3Y8{s=BhsB6WvOm6IBYq#m{`jb(=-DTx*(s!7VSv;zT8HvVK|ikhbt-adOnKcoNXiuU#yV{bgeGxfJ`O5(rt6W5!YIy1DRf?QXDdGm>W zRPgjiucW#zhWY!kt{DnL16{Y+Z_%x1YjgHn)>G8cz_F*6wx!yp?Hsb_C-`5r%6?^x zC${4$miHU>yJx>c7tDplVKTlD)38R&(M?QCKXZq=?k&yChK}ApDyT!p9_!ezs+-

yZ zldad-XiOfa-uFmwhBa7P+1p9cRdq|3-yin$zU}Cch-SDGQ<)z!%eM5m6k_`i#qJn` zVdi<1zNb4mrr|OPc1~+5FiRQZc&i`94lbwTp6<{d`S#--`ikksdJOH^l`_ypCsGYx z?!g>MT}}+g^}>ExyH#;IIc9>2n)YB}KcSo_ShvMD>n(Y5d7XKo>`blqv{9+p+Q zw4JeHa#LEg{v{&?oRkEfydf08#|cwS#dVJg*rQ=vg|}~d4z-%lU$PBHr?=0p0%ZIj zAmihI{Oey7f3dMafBqE6Xxb`P;b{Fg?;gh{d(a&h;~f>Yi{-*Q4A!ol9O4hdmzH~| zsYgB#PNt5@VNg>`x~Y!=4{m9@xLqo6;34ploz%ym6GxMxYL82oozg=>TPy^dTE^O) za=Bar7UTOZR~_nO<@wS)m(`%>5a3m`bk9|li7w`=ZlUjTC+scg6~XrHgM))od8f3q zL*2IAx#cO3TbBD=7!paPqkm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ju)3uzbxLS4HT;I%g1{8Xdll zGsvUfK@6XywNdpBUageWa6!F&uGnng5xP^>ZnZANE0)sqB@bpM44yV@2%leyj%Gnm zyo`!q2g(Kct+n(9m{}33_Zek z*V&ugc#_7FYX1oJte7SfZ;Ht(X}zI^$>&VhUOCA}l4Ga-_6o1^WfcKjrjhX7@rv)N zE556(_^!UyhJ*3}_y{0GPL&^fs%}UKP1cRX zP*YyJ$LwSw5gdCw#ot0A#)_8m5!?(dKmLLK`afo}ghl`W literal 0 HcmV?d00001 diff --git a/tests/test_myimport.py b/tests/test_myimport.py index 1884c2c7..c925d95c 100644 --- a/tests/test_myimport.py +++ b/tests/test_myimport.py @@ -15,6 +15,19 @@ import myimport +def testImportCeltx()->None: + u.init() + location = os.path.dirname(__file__) + pathToTestScriptCeltx = os.path.join(location, "fixtures/test.celtx") + + lines = myimport.importCeltx(pathToTestScriptCeltx,mock.Mock()) + + assert lines is not None + + expectedScreenplay = u.load() + for line, expectedLine in zip(lines, expectedScreenplay.lines): + assert TextImportMatcher(line) == TextImportMatcher(expectedLine) + def testImportTextFile()->None: u.init() location = os.path.dirname(__file__) From fdeb8abed171c44bead4acb9f15eb882b1fc774e Mon Sep 17 00:00:00 2001 From: Jano Paetzold Date: Sat, 20 Aug 2022 19:44:05 +0200 Subject: [PATCH 2/9] Load Celtx files correctly Celtx files are zip files, util.load can only load UTF8 encoded text files. Checking a zip file for length doesn't make sense. A check if the zip contains any script files is done later anyways. So this way, the file can be loaded at least. However, the parsing is still incorrect, and creates empty lines where they shouldn't belong. This is going to be addressed int the next commits. --- src/myimport.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/myimport.py b/src/myimport.py index ee70833b..de157149 100644 --- a/src/myimport.py +++ b/src/myimport.py @@ -218,23 +218,8 @@ def sanitizeStr(s): def importCeltx(fileName, frame): # Celtx files are zipfiles, and the script content is within a file # called "script-xxx.html", where xxx can be random. - - # the 5 MB limit is arbitrary, we just want to avoid getting a - # MemoryError exception for /dev/zero etc. - data = util.loadFile(fileName, frame, 5000000) - - if data == None: - return None - - if len(data) == 0: - wx.MessageBox("File is empty.", "Error", wx.OK, frame) - - return None - - buf = io.StringIO(data) - try: - z = zipfile.ZipFile(buf) + z = zipfile.ZipFile(fileName) except: wx.MessageBox("File is not a valid Celtx script file.", "Error", wx.OK, frame) return None From 9181f5b9dbdc1d5de1c86e1acc8dfa24892c09db Mon Sep 17 00:00:00 2001 From: Jano Paetzold Date: Sat, 20 Aug 2022 20:08:26 +0200 Subject: [PATCH 3/9] Remove whitespace lines while importing Celtx The lines still don't contain the correct line breaks (you have one paragraph in one line right now), so the tests still fail. But I noticed that importing and saving the Celtx file in Trelby creates a .trelby file usingn the correct line breaks. So creating the correct line breaks should easily be doable automatically, I just have to find that code and apply it after importing. --- src/myimport.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/myimport.py b/src/myimport.py index de157149..889c295b 100644 --- a/src/myimport.py +++ b/src/myimport.py @@ -275,7 +275,9 @@ def addElem(eleType, lns): for para in root.xpath("/html/body/p"): items = [] for line in para.itertext(): - items.append(str(line.replace("\n", " "))) + text = str(line.replace("\n", " ")) + if text.strip() != '': + items.append(text) lt = elemMap.get(para.get("class"), screenplay.ACTION) From 98f4ce0810a28b7a586af355b54065204baded01 Mon Sep 17 00:00:00 2001 From: Jano Paetzold Date: Sun, 28 Aug 2022 17:14:05 +0200 Subject: [PATCH 4/9] Reformat screenplay before comparing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before comparing an imported screenplay, it needs to be reformatted with the same configuration as the one we load for comparison (which is the default one). Now, the tests still fail because some lines end with spaces – but for the rest, it seems to work! --- tests/test_myimport.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/test_myimport.py b/tests/test_myimport.py index c925d95c..729ea910 100644 --- a/tests/test_myimport.py +++ b/tests/test_myimport.py @@ -20,12 +20,18 @@ def testImportCeltx()->None: location = os.path.dirname(__file__) pathToTestScriptCeltx = os.path.join(location, "fixtures/test.celtx") - lines = myimport.importCeltx(pathToTestScriptCeltx,mock.Mock()) + importedLines = myimport.importCeltx(pathToTestScriptCeltx,mock.Mock()) - assert lines is not None + assert importedLines is not None + + # in order to compare the screenplays, we need to reformat it with the same configuration as the loaded one + importedScreenplay = u.new() + importedScreenplay.lines = importedLines + importedScreenplay.reformatAll() expectedScreenplay = u.load() - for line, expectedLine in zip(lines, expectedScreenplay.lines): + + for line, expectedLine in zip(importedScreenplay.lines, expectedScreenplay.lines): assert TextImportMatcher(line) == TextImportMatcher(expectedLine) def testImportTextFile()->None: From 3a6bb4aaff72a64bff918bc3aa505c25fad097cd Mon Sep 17 00:00:00 2001 From: Jano Paetzold Date: Sun, 28 Aug 2022 17:17:19 +0200 Subject: [PATCH 5/9] Remove whitespace from end of line in fixture --- tests/fixtures/test.celtx | Bin 32001 -> 32000 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/tests/fixtures/test.celtx b/tests/fixtures/test.celtx index 06d753d58d22c8895418655d1acbfa0e68c0b768..3217cfd108da520205d666ecf6f08bb0930b3420 100644 GIT binary patch delta 850 zcmY+CT}V@57{||>x?JO|(9}-O85OnF*0!UY^CPvHUoCUyrml2~x)O)A1kKvOA~ev< z@-L(pA#{@x7V&x!g45e5Xq7?q;nziA&_x#|Nnz)l5!Hdi`@!=(@BjaMo~!HR$~s{k z_NeIX3=_*RNqwrvY*I{=u+sf8CpWRe##J?1m5eYrBA?W6ORvPd2~8> zEaWMnJ}-lzc`x$qahS{-!I=3FHu!kd39*kdJi?yCo7`d;b9Gd4<|RRL^BQFS6d1e- z_{2-~mmDm#^*)4~I1E^M+;y%9brPtv{naMAP!J#pxQw*AMaWjRl%n1(r)`79?;&U{(IDqI3v<&HQtQ@eteuUPB+-Vq z1fNSHa(37__|u}%SE0cV^BoDpw2(DcV#iElfmAoqBO?geSv;)|NkGOO%e1!8NTkDr zL+w(n_yowmYf+8Y0`_45x`$ESn56;BrxTrNOml~7X({;I=ZaCMzC>& zLwEH8+=Uwa5+vU%pT}V3-=2kpo_Q)q(CyOECq?hbPyq{@)s88tEp+Cbk%$wqq^qEs zRsrY38ad4=eNN~x+c3dQ`ihiU?w^hTKH*_8j2d;U7F`ejkO(Z~5I)ztft@-#CND_w~ nTZ7rsS{6+If97#BXiWVx-S-^~BmN5J-_L-LLA7inAm053t=K&U delta 822 zcmY+CZ%C6-6vp2>|1;j9_vjpAZrDT^>)so(vaV7*BSq?rZ8UJPQ}rNNrkkE;y=p0+7a*0zKXCM9GB0Vy@%*zjt= zd*blc=|^`yt1VYR=Sm;0aj@$JWE#$kq9&M#(IzK;nvHnWmyZok6xQ}Bv09@V3s_|# zahR%zp<5k~308Y{utFs*uN@+oF%*fJ?>s8;l+Mj?;k5+__v6#`Z*U2b_pXxo%g9ISXE#bY-aF2HAajij#jBH7px_gNUKe>v2 zn?S7H z@8&KLI@hcqR9(mV1@e^i$ca884*2t7p6bu2iD-pQlf8WxMJEB?lk-{zl}&-^ zye~ARm(kvRJct8!#n^m4q4utalC>@s@VKozh_ Date: Wed, 31 Aug 2022 12:19:29 +0200 Subject: [PATCH 6/9] Don't add whitespace while importing Line breaks in the HTML are replaced with spaces (which is correct, as line breaks should be ignored, and two words separated with a line break should stay separated). But this lead to lines starting with a space sometimes. Now leading and trailing whitespace will be removed. --- src/myimport.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/myimport.py b/src/myimport.py index 889c295b..5b2d68f7 100644 --- a/src/myimport.py +++ b/src/myimport.py @@ -275,8 +275,8 @@ def addElem(eleType, lns): for para in root.xpath("/html/body/p"): items = [] for line in para.itertext(): - text = str(line.replace("\n", " ")) - if text.strip() != '': + text = line.replace("\n", " ").strip() + if text != '': items.append(text) lt = elemMap.get(para.get("class"), screenplay.ACTION) From 10c4e755edc3d50511ae0aee07b8c290a9cb28cd Mon Sep 17 00:00:00 2001 From: Jano Paetzold Date: Wed, 31 Aug 2022 12:37:43 +0200 Subject: [PATCH 7/9] Compare lines literally for Celtx import For Text import, we had a very loose comparison, as text files can't preserve all details. .celtx files can, that's why it should be possible to compare the lines literally. --- tests/test_myimport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_myimport.py b/tests/test_myimport.py index 729ea910..32910ba3 100644 --- a/tests/test_myimport.py +++ b/tests/test_myimport.py @@ -32,7 +32,7 @@ def testImportCeltx()->None: expectedScreenplay = u.load() for line, expectedLine in zip(importedScreenplay.lines, expectedScreenplay.lines): - assert TextImportMatcher(line) == TextImportMatcher(expectedLine) + assert line == expectedLine def testImportTextFile()->None: u.init() From ee6a871e5c9607b8c1c8f503f978ec3a5ef5ca0b Mon Sep 17 00:00:00 2001 From: Jano Paetzold Date: Wed, 31 Aug 2022 12:42:52 +0200 Subject: [PATCH 8/9] Add __repr__() method to Line for easier debugging --- src/screenplay.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/screenplay.py b/src/screenplay.py index 9b5358c9..3d1346bd 100644 --- a/src/screenplay.py +++ b/src/screenplay.py @@ -3266,6 +3266,9 @@ def __str__(self): return config.lb2char(self.lb) + config.lt2char(self.lt)\ + self.text + def __repr__(self)->str: + return self.__str__() + def __ne__(self, other): return ((self.lt != other.lt) or (self.lb != other.lb) or (self.text != other.text)) From ba0339769fa656663ac0b09d0b58dca4ab4d4795 Mon Sep 17 00:00:00 2001 From: Jano Paetzold Date: Wed, 31 Aug 2022 12:45:35 +0200 Subject: [PATCH 9/9] Align case in .celtx fixture with the one in .trelby fixture --- tests/fixtures/test.celtx | Bin 32000 -> 32284 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/tests/fixtures/test.celtx b/tests/fixtures/test.celtx index 3217cfd108da520205d666ecf6f08bb0930b3420..86a36b59b930d74a4e3b57c17cd2ff802e4714cc 100644 GIT binary patch delta 1023 zcmY*YT})GF7(QQZ3y9|^YQs7~Dg5KZnvWXw}kb#}L7MkD6NcE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