From 41a48455f825c8e507745ba315215edf73006c31 Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Tue, 9 Feb 2021 18:57:22 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=94=EF=B8=8F=20Explicitly=20check=20for?= =?UTF-8?q?=20None?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Explicitly check for None to remove this warning: test/test_recognize.py::test_word_segmentation /home/mike/devel/ocrd_calamari/test/test_recognize.py:133: FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead. assert line --- test/test_recognize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_recognize.py b/test/test_recognize.py index fdb2679..976469f 100644 --- a/test/test_recognize.py +++ b/test/test_recognize.py @@ -130,7 +130,7 @@ def test_word_segmentation(workspace): # The result should contain a TextLine that contains the text "December" line = tree.xpath(".//pc:TextLine[pc:TextEquiv/pc:Unicode[contains(text(),'December')]]", namespaces=NSMAP)[0] - assert line + assert line is not None # The textline should a. contain multiple words and b. these should concatenate fine to produce the same line text words = line.xpath(".//pc:Word", namespaces=NSMAP)