Example #1
0
    def test(self):
        n = Name_Cadastre_FR(None)

        class _config:
            options = {"country": None, "language": None}

        class father:
            config = _config()

        n.father = father()
        n.init(None)
        data = {'id': 0, 'lat': 0, 'lon': 0}

        with with_options(n, {'country': 'FR'}):
            self.check_not_err(n.node(data, {
                u'name': u'ZA Sud Loire',
                u'place': u'hamlet'
            }),
                               expected={
                                   'class': 50801,
                                   'subclass': 0
                               })
        with with_options(n, {'country': 'FR'}):
            self.check_err(n.node(data, {
                u'name': u'Montdésert-Sud',
                u'place': u'hamlet'
            }),
                           expected={
                               'class': 50801,
                               'subclass': 0
                           })
Example #2
0
    def test(self):
        TestPluginCommon.setUp(self)
        p = Name_Multiple(None)

        class _config:
            options = {"country": None}

        class father:
            config = _config()

        p.father = father()

        with with_options(p, {'country': 'TH'}):
            p.init(None)
            self.check_err(p.way(None, {"name": "aueuie ; ueuaeuie"}, None))
            self.check_err(p.way(None, {"name": "aueuie / ueuaeuie"}, None))
            self.check_err(p.way(None, {"name": "aueuie + ueuaeuie"}, None))
            assert not p.way(None, {"amenity": "aueuie + ueuaeuie"}, None)
            assert not p.way(None, {
                "name": "aueuie + ueuaeuie",
                "aeroway": "yes"
            }, None)
            assert not p.way(None, {"name": "Profil+"}, None)
            assert not p.way(None, {"name": u"บ้านแพะแม่คือ ซอย 5/10"}, None)
            assert not p.way(None, {"name": u"บ้านแพะแม่คือ ซอย 5/๓๔๕"}, None)
            assert not p.way(None, {
                "name": "streetA/streetB",
                "public_transport": "platform"
            }, None)

        with with_options(p, {'country': 'US-TX'}):
            p.init(None)
            assert not p.way(None, {"name": u"County Route 7/2"}, None)
            assert not p.way(None, {"name": u"16 5/10 Road"}, None)

        with with_options(p, {'country': 'BY'}):
            p.init(None)
            assert not p.way(None, {"name": u"д/с №68"}, None)
            assert p.way(None, {
                "name": u"д/с №68",
                "highway": "terciary"
            }, None)

        with with_options(p, {'country': 'CH'}):
            p.init(None)
            assert not p.way(None, {"name": u"Waffenplatz-/Bederstrasse"},
                             None)

        with with_options(p, {'country': 'DJ'}):
            p.init(None)
            assert not p.way(None, {"name": u"Avenue 17 / جادة 17"}, None)

        assert not p.way(None, {"name": u"Gas station no. 21/2356"}, None)
    def test(self):
        n = Name_MisspelledWordByRegex_Lang_fa(None)

        class _config:
            options = {"country": None, "language": None}

        class father:
            config = _config()

        n.father = father()
        n.init(None)
        data = {'id': 0, 'lat': 0, 'lon': 0}

        with with_options(n, {'language': 'fa'}):
            self.check_err(n.node(data,
                                  {u'name': u'روابط عمومي مجتمع مس شهربابك'}),
                           expected={
                               'class': 50109001,
                               'subclass': 0
                           })
        self.check_err(n.node(data,
                              {u'name:fa': u'روابط عمومي مجتمع مس شهربابك'}),
                       expected={
                           'class': 50109001,
                           'subclass': 0
                       })
        self.check_not_err(n.node(data,
                                  {u'name': u'روابط عمومي مجتمع مس شهربابك'}),
                           expected={
                               'class': 50109001,
                               'subclass': 0
                           })
        with with_options(n, {'language': 'fa'}):
            self.check_err(n.node(data,
                                  {u'name': u'روابط عمومي مجتمع مس شهربابك'}),
                           expected={
                               'class': 50109001,
                               'subclass': 1
                           })
        self.check_err(n.node(data,
                              {u'name:fa': u'روابط عمومي مجتمع مس شهربابك'}),
                       expected={
                           'class': 50109001,
                           'subclass': 1
                       })
        self.check_not_err(n.node(data,
                                  {u'name': u'روابط عمومي مجتمع مس شهربابك'}),
                           expected={
                               'class': 50109001,
                               'subclass': 1
                           })
    def test(self):
        n = Josm_FranceSpecificRules(None)
        class _config:
            options = {"country": None, "language": None}
        class father:
            config = _config()
        n.father = father()
        n.init(None)
        data = {'id': 0, 'lat': 0, 'lon': 0}

        with with_options(n, {'country': 'FR'}):
            self.check_not_err(n.way(data, {u'railway': u'disused'}, [0]), expected={'class': 21600, 'subclass': 0})
        with with_options(n, {'country': 'FR'}):
            self.check_not_err(n.way(data, {u'gauge': u'1435', u'railway': u'rail'}, [0]), expected={'class': 21600, 'subclass': 0})
        with with_options(n, {'country': 'FR'}):
            self.check_err(n.way(data, {u'railway': u'rail'}, [0]), expected={'class': 21600, 'subclass': 0})
    def test(self):
        n = Name_Cadastre_FR(None)
        class _config:
            options = {"country": None, "language": None}
        class father:
            config = _config()
        n.father = father()
        n.init(None)
        data = {'id': 0, 'lat': 0, 'lon': 0}

        with with_options(n, {'country': 'FR'}):
            self.check_not_err(n.node(data, {u'name': u'ZA Sud Loire', u'place': u'hamlet'}), expected={'class': 50801, 'subclass': 0})
        with with_options(n, {'country': 'FR'}):
            self.check_err(n.node(data, {u'name': u'Montdésert-Sud', u'place': u'hamlet'}), expected={'class': 50801, 'subclass': 0})
        with with_options(n, {'country': 'FR'}):
            self.check_not_err(n.node(data, {u'name': u'ZA Sud Loire', u'place': u'hamlet'}), expected={'class': 50801, 'subclass': 0})
        with with_options(n, {'country': 'FR'}):
            self.check_err(n.node(data, {u'name': u'Montdésert-Sud', u'place': u'hamlet'}), expected={'class': 50801, 'subclass': 0})
    def test(self):
        n = Name_MisspelledWordByRegex_Lang_fa(None)
        class _config:
            options = {"country": None, "language": None}
        class father:
            config = _config()
        n.father = father()
        n.init(None)
        data = {'id': 0, 'lat': 0, 'lon': 0}

        with with_options(n, {'language': 'fa'}):
            self.check_err(n.node(data, {u'name': u'روابط عمومي مجتمع مس شهربابك'}), expected={'class': 50109001, 'subclass': 0})
        self.check_err(n.node(data, {u'name:fa': u'روابط عمومي مجتمع مس شهربابك'}), expected={'class': 50109001, 'subclass': 0})
        self.check_not_err(n.node(data, {u'name': u'روابط عمومي مجتمع مس شهربابك'}), expected={'class': 50109001, 'subclass': 0})
        with with_options(n, {'language': 'fa'}):
            self.check_err(n.node(data, {u'name': u'روابط عمومي مجتمع مس شهربابك'}), expected={'class': 50109001, 'subclass': 0})
        self.check_err(n.node(data, {u'name:fa': u'روابط عمومي مجتمع مس شهربابك'}), expected={'class': 50109001, 'subclass': 0})
        self.check_not_err(n.node(data, {u'name': u'روابط عمومي مجتمع مس شهربابك'}), expected={'class': 50109001, 'subclass': 0})
        with with_options(n, {'language': 'fa'}):
            self.check_err(n.node(data, {u'name': u'روابط عمومي مجتمع مس شهربابك'}), expected={'class': 50109001, 'subclass': 0})
        self.check_err(n.node(data, {u'name:fa': u'روابط عمومي مجتمع مس شهربابك'}), expected={'class': 50109001, 'subclass': 0})
        self.check_not_err(n.node(data, {u'name': u'روابط عمومي مجتمع مس شهربابك'}), expected={'class': 50109001, 'subclass': 0})
        with with_options(n, {'language': 'fa'}):
            self.check_err(n.node(data, {u'name': u'روابط عمومي مجتمع مس شهربابك'}), expected={'class': 50109001, 'subclass': 0})
        self.check_err(n.node(data, {u'name:fa': u'روابط عمومي مجتمع مس شهربابك'}), expected={'class': 50109001, 'subclass': 0})
        self.check_not_err(n.node(data, {u'name': u'روابط عمومي مجتمع مس شهربابك'}), expected={'class': 50109001, 'subclass': 0})
        with with_options(n, {'language': 'fa'}):
            self.check_err(n.node(data, {u'name': u'روابط عمومي مجتمع مس شهربابك'}), expected={'class': 50109001, 'subclass': 0})
        self.check_err(n.node(data, {u'name:fa': u'روابط عمومي مجتمع مس شهربابك'}), expected={'class': 50109001, 'subclass': 0})
        self.check_not_err(n.node(data, {u'name': u'روابط عمومي مجتمع مس شهربابك'}), expected={'class': 50109001, 'subclass': 0})
        with with_options(n, {'language': 'fa'}):
            self.check_err(n.node(data, {u'name': u'روابط عمومي مجتمع مس شهربابك'}), expected={'class': 50109001, 'subclass': 0})
        self.check_err(n.node(data, {u'name:fa': u'روابط عمومي مجتمع مس شهربابك'}), expected={'class': 50109001, 'subclass': 0})
        self.check_not_err(n.node(data, {u'name': u'روابط عمومي مجتمع مس شهربابك'}), expected={'class': 50109001, 'subclass': 0})
Example #7
0
    def test(self):
        TestPluginCommon.setUp(self)
        p = Name_Multiple(None)
        class _config:
            options = {"country": None}
        class father:
            config = _config()
        p.father = father()

        with with_options(p, {'country': 'TH'}):
            p.init(None)
            self.check_err(p.way(None, {"name": "aueuie ; ueuaeuie"}, None))
            self.check_err(p.way(None, {"name": "aueuie / ueuaeuie"}, None))
            self.check_err(p.way(None, {"name": "aueuie + ueuaeuie"}, None))
            assert not p.way(None, {"amenity": "aueuie + ueuaeuie"}, None)
            assert not p.way(None, {"name": "aueuie + ueuaeuie", "aeroway": "yes"}, None)
            assert not p.way(None, {"name": "Profil+"}, None)
            assert not p.way(None, {"name": u"บ้านแพะแม่คือ ซอย 5/10"}, None)
            assert not p.way(None, {"name": u"บ้านแพะแม่คือ ซอย 5/๓๔๕"}, None)

        with with_options(p, {'country': 'US-TX'}):
            p.init(None)
            assert not p.way(None, {"name": u"County Route 7/2"}, None)
            assert not p.way(None, {"name": u"16 5/10 Road"}, None)

        with with_options(p, {'country': 'BY'}):
            p.init(None)
            assert not p.way(None, {"name": u"д/с №68"}, None)
            assert p.way(None, {"name": u"д/с №68", "highway": "terciary"}, None)

        with with_options(p, {'country': 'CH'}):
            p.init(None)
            assert not p.way(None, {"name": u"Waffenplatz-/Bederstrasse"}, None)

        with with_options(p, {'country': 'DJ'}):
            p.init(None)
            assert not p.way(None, {"name": u"Avenue 17 / جادة 17"}, None)
    def test(self):
        n = Josm_FranceSpecificRules(None)
        class _config:
            options = {"country": None, "language": None}
        class father:
            config = _config()
        n.father = father()
        n.init(None)
        data = {'id': 0, 'lat': 0, 'lon': 0}

        with with_options(n, {'country': 'FR'}):
            self.check_err(n.node(data, {u'amenity': u'parking', u'name': u'Aire de Covoiturage'}), expected={'class': 20806, 'subclass': 0})
        with with_options(n, {'country': 'FR'}):
            self.check_not_err(n.way(data, {u'railway': u'disused'}, [0]), expected={'class': 21600, 'subclass': 0})
        with with_options(n, {'country': 'FR'}):
            self.check_not_err(n.way(data, {u'gauge': u'1435', u'railway': u'rail'}, [0]), expected={'class': 21600, 'subclass': 0})
        with with_options(n, {'country': 'FR'}):
            self.check_err(n.way(data, {u'railway': u'rail'}, [0]), expected={'class': 21600, 'subclass': 0})
        with with_options(n, {'country': 'FR'}):
            self.check_not_err(n.way(data, {u'amenity': u'car_pooling', u'name': u'Aire de covoiturage'}, [0]), expected={'class': 20806, 'subclass': 0})
        with with_options(n, {'country': 'FR'}):
            self.check_err(n.way(data, {u'amenity': u'car_sharing', u'name': u'Aire de covoiturage'}, [0]), expected={'class': 20806, 'subclass': 0})
        with with_options(n, {'country': 'FR'}):
            self.check_not_err(n.way(data, {u'amenity': u'parking', u'carpool': u'designated', u'name': u'Aire de covoiturage'}, [0]), expected={'class': 20806, 'subclass': 0})
Example #9
0
    def test(self):
        n = Covid19(None)

        class _config:
            options = {"country": None, "language": None}

        class father:
            config = _config()

        n.father = father()
        n.init(None)
        data = {'id': 0, 'lat': 0, 'lon': 0}

        with with_options(n, {'country': 'FR'}):
            self.check_err(n.node(data, {
                'takeaway': 'no',
                'takeaway:covid19': 'yes'
            }),
                           expected={
                               'class': 202004,
                               'subclass': 0
                           })
        with with_options(n, {'country': 'FR'}):
            self.check_err(n.node(data, {
                'delivery': 'no',
                'delivery:covid19': 'yes'
            }),
                           expected={
                               'class': 202004,
                               'subclass': 0
                           })
        with with_options(n, {'country': 'FR'}):
            self.check_not_err(n.way(data, {'takeaway:covid19': 'no'}, [0]),
                               expected={
                                   'class': 202004,
                                   'subclass': 0
                               })
        with with_options(n, {'country': 'FR'}):
            self.check_not_err(n.way(data, {'takeaway:covid19': 'only'}, [0]),
                               expected={
                                   'class': 202004,
                                   'subclass': 0
                               })
        with with_options(n, {'country': 'FR'}):
            self.check_not_err(n.way(data, {
                'takeaway': 'yes',
                'takeaway:covid19': 'yes'
            }, [0]),
                               expected={
                                   'class': 202004,
                                   'subclass': 0
                               })
        with with_options(n, {'country': 'FR'}):
            self.check_err(n.way(data, {'takeaway:covid19': 'yes'}, [0]),
                           expected={
                               'class': 202004,
                               'subclass': 0
                           })
        with with_options(n, {'country': 'FR'}):
            self.check_not_err(n.way(data, {'delivery:covid19': 'no'}, [0]),
                               expected={
                                   'class': 202004,
                                   'subclass': 0
                               })
        with with_options(n, {'country': 'FR'}):
            self.check_not_err(n.way(data, {'delivery:covid19': 'only'}, [0]),
                               expected={
                                   'class': 202004,
                                   'subclass': 0
                               })
        with with_options(n, {'country': 'FR'}):
            self.check_not_err(n.way(data, {
                'delivery': 'yes',
                'delivery:covid19': 'yes'
            }, [0]),
                               expected={
                                   'class': 202004,
                                   'subclass': 0
                               })
        with with_options(n, {'country': 'FR'}):
            self.check_err(n.way(data, {'delivery:covid19': 'yes'}, [0]),
                           expected={
                               'class': 202004,
                               'subclass': 0
                           })
        with with_options(n, {'country': 'FR'}):
            self.check_not_err(n.way(
                data, {
                    'opening_hours': 'Mo-Su 09:00-20:00',
                    'opening_hours:covid19': 'Mo-Su 09:00-20:00'
                }, [0]),
                               expected={
                                   'class': 202004,
                                   'subclass': 0
                               })
        with with_options(n, {'country': 'FR'}):
            self.check_err(n.way(data, {'opening_hours:covid19': 'restricted'},
                                 [0]),
                           expected={
                               'class': 202004,
                               'subclass': 0
                           })
        with with_options(n, {'country': 'FR'}):
            self.check_not_err(n.way(data, {'opening_hours:covid19': 'same'},
                                     [0]),
                               expected={
                                   'class': 202004,
                                   'subclass': 0
                               })
        with with_options(n, {'country': 'FR'}):
            self.check_not_err(n.way(
                data, {
                    'opening_hours': 'Mo-Su 09:00-20:00',
                    'opening_hours:covid19': 'Mo-Su 09:00-20:00'
                }, [0]),
                               expected={
                                   'class': 202004,
                                   'subclass': 0
                               })
        with with_options(n, {'country': 'FR'}):
            self.check_err(n.way(
                data, {'opening_hours:covid19': 'Mo-Su 09:00-20:00'}, [0]),
                           expected={
                               'class': 202004,
                               'subclass': 0
                           })