skiros2 icon indicating copy to clipboard operation
skiros2 copied to clipboard

Unit test state

Open matthiashh opened this issue 5 years ago • 3 comments

I am currently looking at the unit tests and quite a lot of them fail on my platform and there could be several reasons for that.

========= Testing json serialization =========
**********************************************************************
File "/home/matthias/catkin_ws/src/skiros2/skiros2_common/src/skiros2_common/ros/utils.py", line 226, in skiros2_common.ros.utils.serializeParamMap
Failed example:
    serializeParamMap(ph._params)
Expected:
    [param: {"values": [], "specType": 2, "type": "dict", "description": "", "key": "MyDict"}]
Got:
    [param: "{\"values\": [], \"specType\": 0, \"type\": \"dict\", \"description\": \"\", \"key\"\
      : \"MyDict\"}"]
**********************************************************************
File "/home/matthias/catkin_ws/src/skiros2/skiros2_common/src/skiros2_common/ros/utils.py", line 229, in skiros2_common.ros.utils.serializeParamMap
Failed example:
    serializeParamMap(ph._params)
Expected:
    [param: {"values": [], "specType": 2, "type": "list", "description": "", "key": "MyList"}, param: {"values": [], "specType": 2, "type": "dict", "description": "", "key": "MyDict"}]
Got:
    [param: "{\"values\": [], \"specType\": 0, \"type\": \"list\", \"description\": \"\", \"key\"\
      : \"MyList\"}", param: "{\"values\": [], \"specType\": 0, \"type\": \"dict\", \"description\": \"\", \"key\"\
      : \"MyDict\"}"]

There's several things here:

  1. I get a lot of those backslashes in my results. I can compensate in the test result of course, but I was wondering if this is something platform specific since I am running Ubuntu 18.04 and python 2.7.

  2. In both tests specType should be 2 but is 0. Is the unittest outdated or is there a bug in the code?

There is also some of those:

File "/home/matthias/catkin_ws/src/skiros2_std_lib/skiros2_std_reasoners/src/skiros2_std_reasoners/aau_spatial_reasoner.py", line 465, in skiros2_std_reasoners.aau_spatial_reasoner.AauSpatialReasoner._getAIRelations
Failed example:
    sr._getAIRelations(3, 3, 3, 3, 'X')
Expected:
    [':mX']
Got:
    [':mX', 0.0]

But looking at the code it looks like the test hasn't been updated.

matthiashh avatar Feb 28 '19 22:02 matthiashh

Indeed they haven't =) Thanks for reporting the issue

frovida avatar Mar 01 '19 11:03 frovida

I fixed all the ones on the master branch in my local development branch. I can push that one later and create a pull request. I marked all the changes in values with "TODO" so they should be quite obvious.

matthiashh avatar Mar 01 '19 12:03 matthiashh

Unit test works now, but I will keep this open and make some more tests.

frovida avatar Apr 26 '19 09:04 frovida

More tests were added with e7a6e2ff8bf124b8098d410590a28629a5861e66 and e7a6e2ff8bf124b8098d410590a28629a5861e66. Closing

matthias-mayr avatar Dec 09 '22 20:12 matthias-mayr