Closed nlehuby closed 5 years ago
May be try to add assert to validate the regex?
Good idea, it's done.
Do you know how I can test it ?
I tested it with Osmose
Traceback (most recent call last):
File "/home/fred/frodrigo-osmose-backend/plugins/Josm_transport.py", line 560, in test
self.check_err(n.relation(data, {u'interval': u'00:70:00'}, []), expected={'class': 9014021, 'subclass': 726428353})
File "/home/fred/frodrigo-osmose-backend/plugins/Plugin.py", line 148, in check_err
assert errors, log
nose.proxy.AssertionError: Valid errors expected
assertMatch and assertNoMatch: You can give there examples, which should (assertMatch) or should not (assertNoMatch) match the used selector. So this is a test if the selector works correct for the given example. Normally this is only usefull for more complex selectors and less for simple key-value selectors. The tests are executed in the context of unit tests and on jenkins/job/JOSM. They are also executed for local validator files if the advanced option validator.check_assert_local_rules is set to "true" in the advanced preferences (see #10206). If you enabled this option and the test fails, you will get a message in the console output which can look like: WARNING: Expecting test '...' to match way ... or ...to not match....
https://josm.openstreetmap.de/wiki/Help/Validator/MapCSSTagChecker
Thanks for these valuable info. I've updated the doc, the rules and the tests accordingly.
Fix #36