[test] Adding test for intersection phrases and fixing a test failure for the Czech config
This commit is contained in:
@@ -73,7 +73,7 @@ cross_streets:
|
|||||||
sample_probability: 0.2
|
sample_probability: 0.2
|
||||||
intersection:
|
intersection:
|
||||||
default: *a
|
default: *a
|
||||||
probability: 0.7
|
probability: 0.6
|
||||||
alternatives:
|
alternatives:
|
||||||
- alternative: *na
|
- alternative: *na
|
||||||
probability: 0.1
|
probability: 0.1
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import unittest
|
|||||||
|
|
||||||
from geodata.addresses.entrances import *
|
from geodata.addresses.entrances import *
|
||||||
from geodata.addresses.floors import *
|
from geodata.addresses.floors import *
|
||||||
|
from geodata.intersections.query import *
|
||||||
from geodata.addresses.po_boxes import *
|
from geodata.addresses.po_boxes import *
|
||||||
from geodata.addresses.postcodes import *
|
from geodata.addresses.postcodes import *
|
||||||
from geodata.addresses.staircases import *
|
from geodata.addresses.staircases import *
|
||||||
@@ -52,6 +53,13 @@ class TestAddressConfigs(unittest.TestCase):
|
|||||||
break
|
break
|
||||||
self.assertTrue(self.valid_phrase(phrase), six.u('phrase was: {}').format(phrase))
|
self.assertTrue(self.valid_phrase(phrase), six.u('phrase was: {}').format(phrase))
|
||||||
|
|
||||||
|
def check_intersection_phrases(self, language, country=None):
|
||||||
|
for i in xrange(1000):
|
||||||
|
phrase = Intersection.phrase(language, country=country)
|
||||||
|
if phrase is None:
|
||||||
|
break
|
||||||
|
self.assertTrue(self.valid_phrase(phrase), six.u('phrase was: {}').format(phrase))
|
||||||
|
|
||||||
def check_category_phrases(self, language, country=None):
|
def check_category_phrases(self, language, country=None):
|
||||||
for i in xrange(1000):
|
for i in xrange(1000):
|
||||||
phrase = Category.phrase(language, 'amenity', 'restaurant', country=country)
|
phrase = Category.phrase(language, 'amenity', 'restaurant', country=country)
|
||||||
@@ -68,6 +76,8 @@ class TestAddressConfigs(unittest.TestCase):
|
|||||||
self.check_floor_phrases(language, country=country)
|
self.check_floor_phrases(language, country=country)
|
||||||
print('Checking units')
|
print('Checking units')
|
||||||
self.check_unit_phrases(language, country=country)
|
self.check_unit_phrases(language, country=country)
|
||||||
|
print('Checking intersections')
|
||||||
|
self.check_intersection_phrases(language, country=country)
|
||||||
print('Checking categories')
|
print('Checking categories')
|
||||||
self.check_category_phrases(language, country=country)
|
self.check_category_phrases(language, country=country)
|
||||||
print('Checking PO boxes')
|
print('Checking PO boxes')
|
||||||
|
|||||||
Reference in New Issue
Block a user