Jungle-Bus / transport_mapcss

A set of uncompromising validation rules about public transport in JOSM
GNU General Public License v3.0
6 stars 4 forks source link

update regexp for duration & interval check #37

Closed nlehuby closed 5 years ago

nlehuby commented 5 years ago

Fix #36

frodrigo commented 5 years ago

May be try to add assert to validate the regex?

nlehuby commented 5 years ago

Good idea, it's done.

Do you know how I can test it ?

frodrigo commented 5 years ago

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
frodrigo commented 5 years ago

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

nlehuby commented 5 years ago

Thanks for these valuable info. I've updated the doc, the rules and the tests accordingly.