✔️ Explicitly check for None

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
fix/readme-no-checkpoint
Gerber, Mike 3 years ago
parent 3a4013572c
commit 41a48455f8

@ -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)

Loading…
Cancel
Save