Browse Source

Fix tests for the newly added description

Kentaro Wada 2 years ago
parent
commit
907a871c8f
2 changed files with 7 additions and 4 deletions
  1. 1 1
      labelme/app.py
  2. 6 3
      tests/labelme_tests/widgets_tests/test_label_dialog.py

+ 1 - 1
labelme/app.py

@@ -1206,7 +1206,7 @@ class MainWindow(QtWidgets.QMainWindow):
             points = shape["points"]
             shape_type = shape["shape_type"]
             flags = shape["flags"]
-            description = shape["description"]
+            description = shape.get("description", "")
             group_id = shape["group_id"]
             other_data = shape["other_data"]
 

+ 6 - 3
tests/labelme_tests/widgets_tests/test_label_dialog.py

@@ -61,10 +61,11 @@ def test_LabelDialog_popUp(qtbot):
         qtbot.keyClick(widget.edit, QtCore.Qt.Key_Enter)  # NOQA
 
     QtCore.QTimer.singleShot(500, interact)
-    label, flags, group_id = widget.popUp("cat")
+    label, flags, group_id, description = widget.popUp("cat")
     assert label == "person"
     assert flags == {}
     assert group_id is None
+    assert description == ""
 
     # popUp()
 
@@ -73,10 +74,11 @@ def test_LabelDialog_popUp(qtbot):
         qtbot.keyClick(widget.edit, QtCore.Qt.Key_Enter)  # NOQA
 
     QtCore.QTimer.singleShot(500, interact)
-    label, flags, group_id = widget.popUp()
+    label, flags, group_id, description = widget.popUp()
     assert label == "person"
     assert flags == {}
     assert group_id is None
+    assert description == ""
 
     # popUp() + key_Up
 
@@ -88,7 +90,8 @@ def test_LabelDialog_popUp(qtbot):
         qtbot.keyClick(widget.edit, QtCore.Qt.Key_Enter)  # NOQA
 
     QtCore.QTimer.singleShot(500, interact)
-    label, flags, group_id = widget.popUp()
+    label, flags, group_id, description = widget.popUp()
     assert label == "dog"
     assert flags == {}
     assert group_id is None
+    assert description == ""