PyPaf 1.0.2__tar.gz → 1.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pypaf-1.0.2/src/PyPaf.egg-info → pypaf-1.0.3}/PKG-INFO +1 -1
- {pypaf-1.0.2 → pypaf-1.0.3/src/PyPaf.egg-info}/PKG-INFO +1 -1
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/premises/building_type.py +12 -2
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/premises/exception.py +1 -1
- pypaf-1.0.3/src/paf/version.py +3 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/tests/test_rule_6.py +85 -0
- pypaf-1.0.2/src/paf/version.py +0 -3
- {pypaf-1.0.2 → pypaf-1.0.3}/LICENSE.txt +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/README.md +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/pyproject.toml +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/setup.cfg +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/PyPaf.egg-info/SOURCES.txt +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/PyPaf.egg-info/dependency_links.txt +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/PyPaf.egg-info/top_level.txt +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/__init__.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/address.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/attribute.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/immutable.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/initiator.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/lineable.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/premises/__init__.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/premises/attribute.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/premises/dependent_premisable.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/premises/extender.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/premises/lineable.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/premises/premisable.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/premises/rule000.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/premises/rule001.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/premises/rule010.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/premises/rule011.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/premises/rule100.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/premises/rule101.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/premises/rule110.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/premises/rule111.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/premises/split.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/src/paf/thoroughfare_locality.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/tests/test_empty.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/tests/test_exception_i.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/tests/test_exception_ii.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/tests/test_exception_iii.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/tests/test_exception_iv.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/tests/test_immutability.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/tests/test_kwargs.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/tests/test_mainfile.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/tests/test_po_box.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/tests/test_premises.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/tests/test_rule_1.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/tests/test_rule_2.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/tests/test_rule_3.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/tests/test_rule_4.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/tests/test_rule_5.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/tests/test_rule_7.py +0 -0
- {pypaf-1.0.2 → pypaf-1.0.3}/tests/test_rule_x.py +0 -0
|
@@ -15,14 +15,20 @@ class BuildingTypeMixin(SplitMixin):
|
|
|
15
15
|
"MAISONETTE", "MAISONETTES", "REAR OF",
|
|
16
16
|
"SHOP", "SHOPS", "STALL", "STALLS",
|
|
17
17
|
"SUITE", "SUITES", "UNIT", "UNITS",
|
|
18
|
-
"PO BOX"
|
|
18
|
+
"FLAT", "FLATS", "PO BOX"
|
|
19
19
|
)
|
|
20
20
|
|
|
21
21
|
@classmethod
|
|
22
22
|
@property
|
|
23
23
|
def known_sub_building_types(cls):
|
|
24
24
|
"""Returns known sub-building types"""
|
|
25
|
-
return cls.known_building_types
|
|
25
|
+
return cls.known_building_types
|
|
26
|
+
|
|
27
|
+
@classmethod
|
|
28
|
+
@property
|
|
29
|
+
def known_split_building_types(cls):
|
|
30
|
+
"""Returns known split building types"""
|
|
31
|
+
return ("UNIT",)
|
|
26
32
|
|
|
27
33
|
def is_known_building_type(self, attr='building_name'):
|
|
28
34
|
"""Returns if attribute starts with a known type"""
|
|
@@ -31,3 +37,7 @@ class BuildingTypeMixin(SplitMixin):
|
|
|
31
37
|
def is_known_sub_building_type(self, attr='sub_building_name'):
|
|
32
38
|
"""Returns if attribute starts with a known type"""
|
|
33
39
|
return self.but_last_word(attr) in self.known_sub_building_types
|
|
40
|
+
|
|
41
|
+
def is_known_split_building_type(self, attr='building_name'):
|
|
42
|
+
"""Returns if attribute starts with a known type"""
|
|
43
|
+
return self.but_last_word(attr) in self.known_split_building_types
|
|
@@ -52,6 +52,6 @@ class ExceptionMixin(BuildingTypeMixin, SplitMixin):
|
|
|
52
52
|
and not self.__is_exception_iv(attr)
|
|
53
53
|
and (
|
|
54
54
|
attr != 'building_name'
|
|
55
|
-
or not self.
|
|
55
|
+
or not self.is_known_split_building_type('building_name_last_two_words')
|
|
56
56
|
)
|
|
57
57
|
)
|
|
@@ -286,6 +286,91 @@ class TestRule6WithDoubleException(unittest.TestCase):
|
|
|
286
286
|
self.address.premises(), premises, "Incorrect Rule 6 w/ split building premises")
|
|
287
287
|
|
|
288
288
|
|
|
289
|
+
class TestRule6WithBuilding(unittest.TestCase):
|
|
290
|
+
"""Test Address Rule 6 with Building Non-Exception"""
|
|
291
|
+
|
|
292
|
+
@classmethod
|
|
293
|
+
def setUpClass(cls):
|
|
294
|
+
"""Set up Address instance"""
|
|
295
|
+
cls.address = paf.Address({
|
|
296
|
+
'sub_building_name': "FLAT 1",
|
|
297
|
+
'building_name': "SUNLIFE BUILDING 1A",
|
|
298
|
+
'thoroughfare_name': "SOUTH VIEW",
|
|
299
|
+
'thoroughfare_descriptor': "PLACE",
|
|
300
|
+
'dependent_locality': "MIDSOMER NORTON",
|
|
301
|
+
'post_town': "RADSTOCK",
|
|
302
|
+
'postcode': "BA3 2AX"
|
|
303
|
+
})
|
|
304
|
+
|
|
305
|
+
def test_list(self):
|
|
306
|
+
"""Test conversion to an list"""
|
|
307
|
+
address = [
|
|
308
|
+
"FLAT 1",
|
|
309
|
+
"SUNLIFE BUILDING",
|
|
310
|
+
"1A SOUTH VIEW PLACE",
|
|
311
|
+
"MIDSOMER NORTON",
|
|
312
|
+
"RADSTOCK",
|
|
313
|
+
"BA3 2AX"
|
|
314
|
+
]
|
|
315
|
+
self.assertEqual(
|
|
316
|
+
self.address.as_list(), address, "Incorrect Rule 6 w/ building non list format"
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
def test_string(self):
|
|
320
|
+
"""Test conversion to a string"""
|
|
321
|
+
address = (
|
|
322
|
+
"FLAT 1, "
|
|
323
|
+
"SUNLIFE BUILDING, "
|
|
324
|
+
"1A SOUTH VIEW PLACE, "
|
|
325
|
+
"MIDSOMER NORTON, "
|
|
326
|
+
"RADSTOCK. "
|
|
327
|
+
"BA3 2AX"
|
|
328
|
+
)
|
|
329
|
+
self.assertEqual(
|
|
330
|
+
self.address.as_str(), address, "Incorrect Rule 6 w/ building non string format"
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
def test_tuple(self):
|
|
334
|
+
"""Test conversion to a tuple"""
|
|
335
|
+
address = (
|
|
336
|
+
"FLAT 1",
|
|
337
|
+
"SUNLIFE BUILDING",
|
|
338
|
+
"1A SOUTH VIEW PLACE",
|
|
339
|
+
"MIDSOMER NORTON",
|
|
340
|
+
"RADSTOCK",
|
|
341
|
+
"BA3 2AX"
|
|
342
|
+
)
|
|
343
|
+
self.assertEqual(
|
|
344
|
+
self.address.as_tuple(), address, "Incorrect Rule 6 w/ building non tuple format"
|
|
345
|
+
)
|
|
346
|
+
|
|
347
|
+
def test_dict(self):
|
|
348
|
+
"""Test conversion to a dict"""
|
|
349
|
+
address = {
|
|
350
|
+
'line_1': "FLAT 1",
|
|
351
|
+
'line_2': "SUNLIFE BUILDING",
|
|
352
|
+
'line_3': "1A SOUTH VIEW PLACE",
|
|
353
|
+
'line_4': "MIDSOMER NORTON",
|
|
354
|
+
'post_town': "RADSTOCK",
|
|
355
|
+
'postcode': "BA3 2AX"
|
|
356
|
+
}
|
|
357
|
+
self.assertEqual(
|
|
358
|
+
self.address.as_dict(), address, "Incorrect Rule 6 w/ building non dict format"
|
|
359
|
+
)
|
|
360
|
+
|
|
361
|
+
def test_premises(self):
|
|
362
|
+
"""Test premises"""
|
|
363
|
+
premises = {
|
|
364
|
+
'premises_number': 1,
|
|
365
|
+
'premises_suffix': 'A',
|
|
366
|
+
'premises_name': 'SUNLIFE BUILDING',
|
|
367
|
+
'sub_premises_type': 'FLAT',
|
|
368
|
+
'sub_premises_number': 1
|
|
369
|
+
}
|
|
370
|
+
self.assertEqual(
|
|
371
|
+
self.address.premises(), premises, "Incorrect Rule 6 w/ building non premises")
|
|
372
|
+
|
|
373
|
+
|
|
289
374
|
class TestRule6(unittest.TestCase):
|
|
290
375
|
"""Test Address Rule 6 without Exception"""
|
|
291
376
|
|
pypaf-1.0.2/src/paf/version.py
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|