Skip to content

Commit

Permalink
✔️ Explicitly check for None
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mikegerber committed Feb 9, 2021
1 parent 3a40135 commit 41a4845
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/test_recognize.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 41a4845

Please sign in to comment.