def test__increment_weight_on_match__0(self): """ Tests LocationWrap.increment_weight_on_match with country match """ NAME = 'orange' names = LocationAdminNames(countryname=NAME, admin4name='not') wrap = LocationWrap(location=None, weight=0, adminnames=names) actual = wrap.increment_weight_on_match(NAME) assert actual expected_weight = 1 actual_weight = wrap._weight assert expected_weight == actual_weight
def test__increment_weight_on_match__1(self): """ Tests LocationWrap.increment_weight_on_match with admin1 match """ NAME = 'orange' names = LocationAdminNames(countryname='not orange', admin4name=NAME) wrap = LocationWrap(location=None, weight=3, adminnames=names) actual = wrap.increment_weight_on_match(NAME) assert actual is True expected_weight = 4 actual_weight = wrap._weight assert expected_weight == actual_weight
def test__increment_weight_on_match__no_match(self): """ Tests LocationWrap.increment_weight_on_match with no match """ NAME = 'orange' names = LocationAdminNames( countryname='not orange', admin1name='banana', admin2name='strawberry', admin3name='carrot', admin4name='apple') wrap = LocationWrap(location=None, weight=3, adminnames=names) actual = wrap.increment_weight_on_match(NAME) assert not actual expected_weight = 3 actual_weight = wrap._weight assert expected_weight == actual_weight