PyPaf 0.2.0__tar.gz → 0.4.0__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-0.2.0/src/PyPaf.egg-info → pypaf-0.4.0}/PKG-INFO +9 -9
- {pypaf-0.2.0 → pypaf-0.4.0}/README.md +8 -8
- {pypaf-0.2.0 → pypaf-0.4.0/src/PyPaf.egg-info}/PKG-INFO +9 -9
- {pypaf-0.2.0 → pypaf-0.4.0}/src/PyPaf.egg-info/SOURCES.txt +2 -1
- pypaf-0.4.0/src/paf/__init__.py +6 -0
- pypaf-0.2.0/src/paf/paf.py → pypaf-0.4.0/src/paf/address.py +9 -9
- {pypaf-0.2.0 → pypaf-0.4.0}/src/paf/premises/rule010.py +10 -1
- {pypaf-0.2.0 → pypaf-0.4.0}/src/paf/premises/rule111.py +13 -1
- pypaf-0.4.0/src/paf/version.py +3 -0
- {pypaf-0.2.0 → pypaf-0.4.0}/tests/test_exception_i.py +7 -7
- {pypaf-0.2.0 → pypaf-0.4.0}/tests/test_exception_ii.py +7 -7
- {pypaf-0.2.0 → pypaf-0.4.0}/tests/test_exception_iii.py +7 -7
- pypaf-0.4.0/tests/test_exception_iv.py +100 -0
- {pypaf-0.2.0 → pypaf-0.4.0}/tests/test_mainfile.py +7 -7
- {pypaf-0.2.0 → pypaf-0.4.0}/tests/test_po_box.py +7 -7
- {pypaf-0.2.0 → pypaf-0.4.0}/tests/test_rule_1.py +7 -7
- {pypaf-0.2.0 → pypaf-0.4.0}/tests/test_rule_2.py +7 -7
- {pypaf-0.2.0 → pypaf-0.4.0}/tests/test_rule_3.py +22 -22
- {pypaf-0.2.0 → pypaf-0.4.0}/tests/test_rule_4.py +7 -7
- {pypaf-0.2.0 → pypaf-0.4.0}/tests/test_rule_5.py +16 -12
- {pypaf-0.2.0 → pypaf-0.4.0}/tests/test_rule_6.py +21 -17
- pypaf-0.4.0/tests/test_rule_7.py +91 -0
- pypaf-0.2.0/src/paf/__init__.py +0 -6
- pypaf-0.2.0/src/paf/version.py +0 -3
- pypaf-0.2.0/tests/test_rule_7.py +0 -57
- {pypaf-0.2.0 → pypaf-0.4.0}/LICENSE.txt +0 -0
- {pypaf-0.2.0 → pypaf-0.4.0}/pyproject.toml +0 -0
- {pypaf-0.2.0 → pypaf-0.4.0}/setup.cfg +0 -0
- {pypaf-0.2.0 → pypaf-0.4.0}/src/PyPaf.egg-info/dependency_links.txt +0 -0
- {pypaf-0.2.0 → pypaf-0.4.0}/src/PyPaf.egg-info/top_level.txt +0 -0
- {pypaf-0.2.0 → pypaf-0.4.0}/src/paf/attribute.py +0 -0
- {pypaf-0.2.0 → pypaf-0.4.0}/src/paf/lineable.py +0 -0
- {pypaf-0.2.0 → pypaf-0.4.0}/src/paf/premises/__init__.py +0 -0
- {pypaf-0.2.0 → pypaf-0.4.0}/src/paf/premises/common.py +0 -0
- {pypaf-0.2.0 → pypaf-0.4.0}/src/paf/premises/rule000.py +0 -0
- {pypaf-0.2.0 → pypaf-0.4.0}/src/paf/premises/rule001.py +0 -0
- {pypaf-0.2.0 → pypaf-0.4.0}/src/paf/premises/rule011.py +0 -0
- {pypaf-0.2.0 → pypaf-0.4.0}/src/paf/premises/rule101.py +0 -0
- {pypaf-0.2.0 → pypaf-0.4.0}/src/paf/premises/rule110.py +0 -0
- {pypaf-0.2.0 → pypaf-0.4.0}/src/paf/premises_extender.py +0 -0
- {pypaf-0.2.0 → pypaf-0.4.0}/src/paf/thoroughfare_locality.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: PyPaf
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Formats the elements of a Royal Mail Postcode Address File entry
|
|
5
5
|
Author-email: John Bard <johnbard@globalnet.co.uk>
|
|
6
6
|
License: MIT
|
|
@@ -15,7 +15,7 @@ License-File: LICENSE.txt
|
|
|
15
15
|
|
|
16
16
|
# PyPaf
|
|
17
17
|
|
|
18
|
-
Formats the elements of a Royal Mail Postcode Address File entry according to the rules described in the [Royal Mail Programmer's Guide Edition 7, Version
|
|
18
|
+
Formats the elements of a Royal Mail Postcode Address File entry according to the rules described in the [Royal Mail Programmer's Guide Edition 7, Version 6.2](https://www.poweredbypaf.com/wp-content/uploads/2024/11/Latest-Programmers_guide_Edition-7-Version-6-2.pdf)
|
|
19
19
|
|
|
20
20
|
## Installation
|
|
21
21
|
|
|
@@ -25,11 +25,11 @@ Install it from PyPI:
|
|
|
25
25
|
|
|
26
26
|
## Usage
|
|
27
27
|
|
|
28
|
-
May be used to format the PAF elements as an array of strings:
|
|
28
|
+
May be used to format the PAF Address elements as an array of strings:
|
|
29
29
|
|
|
30
30
|
```python
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
import paf
|
|
32
|
+
address = paf.Address({
|
|
33
33
|
'building_name': "1-2",
|
|
34
34
|
'thoroughfare_name': "NURSERY",
|
|
35
35
|
'thoroughfare_descriptor': "LANE",
|
|
@@ -37,7 +37,7 @@ paf = Paf({
|
|
|
37
37
|
'post_town': "HIGH WYCOMBE",
|
|
38
38
|
'postcode': "HP10 8LS"
|
|
39
39
|
})
|
|
40
|
-
|
|
40
|
+
address.list() # or list(address)
|
|
41
41
|
|
|
42
42
|
['1-2 NURSERY LANE', 'PENN', 'HIGH WYCOMBE', 'HP10 8LS']
|
|
43
43
|
```
|
|
@@ -45,8 +45,8 @@ paf.list() # or list(paf)
|
|
|
45
45
|
Or as a single string:
|
|
46
46
|
|
|
47
47
|
```python
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
import paf
|
|
49
|
+
address = paf.Address({
|
|
50
50
|
'building_name': "1-2",
|
|
51
51
|
'thoroughfare_name': "NURSERY",
|
|
52
52
|
'thoroughfare_descriptor': "LANE",
|
|
@@ -54,7 +54,7 @@ paf = Paf({
|
|
|
54
54
|
'post_town': "HIGH WYCOMBE",
|
|
55
55
|
'postcode': "HP10 8LS"
|
|
56
56
|
})
|
|
57
|
-
|
|
57
|
+
address.str() # or str(address)
|
|
58
58
|
|
|
59
59
|
'1-2 NURSERY LANE, PENN, HIGH WYCOMBE. HP10 8LS'
|
|
60
60
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# PyPaf
|
|
2
2
|
|
|
3
|
-
Formats the elements of a Royal Mail Postcode Address File entry according to the rules described in the [Royal Mail Programmer's Guide Edition 7, Version
|
|
3
|
+
Formats the elements of a Royal Mail Postcode Address File entry according to the rules described in the [Royal Mail Programmer's Guide Edition 7, Version 6.2](https://www.poweredbypaf.com/wp-content/uploads/2024/11/Latest-Programmers_guide_Edition-7-Version-6-2.pdf)
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -10,11 +10,11 @@ Install it from PyPI:
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
-
May be used to format the PAF elements as an array of strings:
|
|
13
|
+
May be used to format the PAF Address elements as an array of strings:
|
|
14
14
|
|
|
15
15
|
```python
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
import paf
|
|
17
|
+
address = paf.Address({
|
|
18
18
|
'building_name': "1-2",
|
|
19
19
|
'thoroughfare_name': "NURSERY",
|
|
20
20
|
'thoroughfare_descriptor': "LANE",
|
|
@@ -22,7 +22,7 @@ paf = Paf({
|
|
|
22
22
|
'post_town': "HIGH WYCOMBE",
|
|
23
23
|
'postcode': "HP10 8LS"
|
|
24
24
|
})
|
|
25
|
-
|
|
25
|
+
address.list() # or list(address)
|
|
26
26
|
|
|
27
27
|
['1-2 NURSERY LANE', 'PENN', 'HIGH WYCOMBE', 'HP10 8LS']
|
|
28
28
|
```
|
|
@@ -30,8 +30,8 @@ paf.list() # or list(paf)
|
|
|
30
30
|
Or as a single string:
|
|
31
31
|
|
|
32
32
|
```python
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
import paf
|
|
34
|
+
address = paf.Address({
|
|
35
35
|
'building_name': "1-2",
|
|
36
36
|
'thoroughfare_name': "NURSERY",
|
|
37
37
|
'thoroughfare_descriptor': "LANE",
|
|
@@ -39,7 +39,7 @@ paf = Paf({
|
|
|
39
39
|
'post_town': "HIGH WYCOMBE",
|
|
40
40
|
'postcode': "HP10 8LS"
|
|
41
41
|
})
|
|
42
|
-
|
|
42
|
+
address.str() # or str(address)
|
|
43
43
|
|
|
44
44
|
'1-2 NURSERY LANE, PENN, HIGH WYCOMBE. HP10 8LS'
|
|
45
45
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: PyPaf
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Formats the elements of a Royal Mail Postcode Address File entry
|
|
5
5
|
Author-email: John Bard <johnbard@globalnet.co.uk>
|
|
6
6
|
License: MIT
|
|
@@ -15,7 +15,7 @@ License-File: LICENSE.txt
|
|
|
15
15
|
|
|
16
16
|
# PyPaf
|
|
17
17
|
|
|
18
|
-
Formats the elements of a Royal Mail Postcode Address File entry according to the rules described in the [Royal Mail Programmer's Guide Edition 7, Version
|
|
18
|
+
Formats the elements of a Royal Mail Postcode Address File entry according to the rules described in the [Royal Mail Programmer's Guide Edition 7, Version 6.2](https://www.poweredbypaf.com/wp-content/uploads/2024/11/Latest-Programmers_guide_Edition-7-Version-6-2.pdf)
|
|
19
19
|
|
|
20
20
|
## Installation
|
|
21
21
|
|
|
@@ -25,11 +25,11 @@ Install it from PyPI:
|
|
|
25
25
|
|
|
26
26
|
## Usage
|
|
27
27
|
|
|
28
|
-
May be used to format the PAF elements as an array of strings:
|
|
28
|
+
May be used to format the PAF Address elements as an array of strings:
|
|
29
29
|
|
|
30
30
|
```python
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
import paf
|
|
32
|
+
address = paf.Address({
|
|
33
33
|
'building_name': "1-2",
|
|
34
34
|
'thoroughfare_name': "NURSERY",
|
|
35
35
|
'thoroughfare_descriptor': "LANE",
|
|
@@ -37,7 +37,7 @@ paf = Paf({
|
|
|
37
37
|
'post_town': "HIGH WYCOMBE",
|
|
38
38
|
'postcode': "HP10 8LS"
|
|
39
39
|
})
|
|
40
|
-
|
|
40
|
+
address.list() # or list(address)
|
|
41
41
|
|
|
42
42
|
['1-2 NURSERY LANE', 'PENN', 'HIGH WYCOMBE', 'HP10 8LS']
|
|
43
43
|
```
|
|
@@ -45,8 +45,8 @@ paf.list() # or list(paf)
|
|
|
45
45
|
Or as a single string:
|
|
46
46
|
|
|
47
47
|
```python
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
import paf
|
|
49
|
+
address = paf.Address({
|
|
50
50
|
'building_name': "1-2",
|
|
51
51
|
'thoroughfare_name': "NURSERY",
|
|
52
52
|
'thoroughfare_descriptor': "LANE",
|
|
@@ -54,7 +54,7 @@ paf = Paf({
|
|
|
54
54
|
'post_town': "HIGH WYCOMBE",
|
|
55
55
|
'postcode': "HP10 8LS"
|
|
56
56
|
})
|
|
57
|
-
|
|
57
|
+
address.str() # or str(address)
|
|
58
58
|
|
|
59
59
|
'1-2 NURSERY LANE, PENN, HIGH WYCOMBE. HP10 8LS'
|
|
60
60
|
```
|
|
@@ -6,9 +6,9 @@ src/PyPaf.egg-info/SOURCES.txt
|
|
|
6
6
|
src/PyPaf.egg-info/dependency_links.txt
|
|
7
7
|
src/PyPaf.egg-info/top_level.txt
|
|
8
8
|
src/paf/__init__.py
|
|
9
|
+
src/paf/address.py
|
|
9
10
|
src/paf/attribute.py
|
|
10
11
|
src/paf/lineable.py
|
|
11
|
-
src/paf/paf.py
|
|
12
12
|
src/paf/premises_extender.py
|
|
13
13
|
src/paf/thoroughfare_locality.py
|
|
14
14
|
src/paf/version.py
|
|
@@ -24,6 +24,7 @@ src/paf/premises/rule111.py
|
|
|
24
24
|
tests/test_exception_i.py
|
|
25
25
|
tests/test_exception_ii.py
|
|
26
26
|
tests/test_exception_iii.py
|
|
27
|
+
tests/test_exception_iv.py
|
|
27
28
|
tests/test_mainfile.py
|
|
28
29
|
tests/test_po_box.py
|
|
29
30
|
tests/test_rule_1.py
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""PAF Address"""
|
|
2
2
|
|
|
3
3
|
from .lineable import LineableMixin
|
|
4
4
|
|
|
5
|
-
class
|
|
6
|
-
"""Main
|
|
5
|
+
class Address(LineableMixin):
|
|
6
|
+
"""Main PAF Address class"""
|
|
7
7
|
|
|
8
8
|
def __init__(self, args):
|
|
9
|
-
"""Initialise
|
|
9
|
+
"""Initialise Address elements"""
|
|
10
10
|
for key in self.__class__.attrs:
|
|
11
11
|
setattr(self, key, '')
|
|
12
12
|
for key, val in args.items():
|
|
@@ -15,27 +15,27 @@ class Paf(LineableMixin):
|
|
|
15
15
|
self.extend_premises()
|
|
16
16
|
|
|
17
17
|
def __repr__(self):
|
|
18
|
-
"""Return full representation of
|
|
18
|
+
"""Return full representation of an Address"""
|
|
19
19
|
args = {k: getattr(self, k) for k in self.__class__.attrs if getattr(self, k, None)}
|
|
20
20
|
return self.__class__.__name__ + '(' + str(args) + ')'
|
|
21
21
|
|
|
22
22
|
def __str__(self):
|
|
23
|
-
"""Return
|
|
23
|
+
"""Return Address as string representation"""
|
|
24
24
|
line = ', '.join(self.lines)
|
|
25
25
|
if self.is_empty('postcode'):
|
|
26
26
|
return line
|
|
27
27
|
return '. '.join([line] + [getattr(self, 'postcode')])
|
|
28
28
|
|
|
29
29
|
def __iter__(self):
|
|
30
|
-
"""Return
|
|
30
|
+
"""Return Address as iterable"""
|
|
31
31
|
yield from self.lines.__iter__()
|
|
32
32
|
if not self.is_empty('postcode'):
|
|
33
33
|
yield from [getattr(self, 'postcode')].__iter__()
|
|
34
34
|
|
|
35
35
|
def str(self):
|
|
36
|
-
"""Return
|
|
36
|
+
"""Return Address as string"""
|
|
37
37
|
return str(self)
|
|
38
38
|
|
|
39
39
|
def list(self):
|
|
40
|
-
"""Return
|
|
40
|
+
"""Return Address as list of strings"""
|
|
41
41
|
return list(self)
|
|
@@ -25,9 +25,18 @@ class Rule010(Common):
|
|
|
25
25
|
"""Returns if building name should be split"""
|
|
26
26
|
return(
|
|
27
27
|
self.is_exception('building_name_last_word') and
|
|
28
|
-
not re.match(r'^\d+$', self.building_name_last_word)
|
|
28
|
+
not re.match(r'^\d+$', self.building_name_last_word) and
|
|
29
|
+
not self.is_non_split_building_name
|
|
29
30
|
)
|
|
30
31
|
|
|
32
|
+
@property
|
|
33
|
+
def is_non_split_building_name(self):
|
|
34
|
+
"""Returns if building name should not be split based on all but last word"""
|
|
35
|
+
return self.building_name_but_last_word in [
|
|
36
|
+
"BACK OF", "BLOCK", "BLOCKS", "BUILDING", "MAISONETTE", "MAISONETTES", "REAR OF",
|
|
37
|
+
"SHOP", "SHOPS", "STALL", "STALLS", "SUITE", "SUITES", "UNIT", "UNITS"
|
|
38
|
+
]
|
|
39
|
+
|
|
31
40
|
@property
|
|
32
41
|
def building_name_last_word(self):
|
|
33
42
|
"""Returns last word of the building name"""
|
|
@@ -8,6 +8,8 @@ class Rule111(Common):
|
|
|
8
8
|
@property
|
|
9
9
|
def premises_rule_attrs(self):
|
|
10
10
|
"""Returns premises list"""
|
|
11
|
+
if self.is_zero_building_number:
|
|
12
|
+
return['sub_name_comma_name']
|
|
11
13
|
if self.is_exception('sub_building_name'):
|
|
12
14
|
return['sub_name_and_name', 'number_and_thoroughfare_or_locality']
|
|
13
15
|
return ['sub_building_name', 'building_name', 'number_and_thoroughfare_or_locality']
|
|
@@ -15,4 +17,14 @@ class Rule111(Common):
|
|
|
15
17
|
@property
|
|
16
18
|
def does_premises_include_first_thoroughfare_or_locality(self):
|
|
17
19
|
"""Returns if premises includes first thoroughfare or locality"""
|
|
18
|
-
return
|
|
20
|
+
return not self.is_zero_building_number
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def is_zero_building_number(self):
|
|
24
|
+
"""Returns if building number is a 0"""
|
|
25
|
+
return getattr(self, 'building_number', '') == "0"
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def sub_name_comma_name(self):
|
|
29
|
+
"""Returns sub-building name and building name concatenated with a comma"""
|
|
30
|
+
return self._concatenate(['sub_building_name', 'building_name'], ', ')
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"""Test
|
|
1
|
+
"""Test Address Exception I formatting"""
|
|
2
2
|
|
|
3
3
|
import unittest
|
|
4
|
-
|
|
4
|
+
import paf
|
|
5
5
|
|
|
6
6
|
class TestExceptionI(unittest.TestCase):
|
|
7
|
-
"""Test
|
|
7
|
+
"""Test Address Exception I"""
|
|
8
8
|
|
|
9
9
|
def setUp(self):
|
|
10
|
-
"""Set up
|
|
11
|
-
self.
|
|
10
|
+
"""Set up Address instance"""
|
|
11
|
+
self.address = paf.Address({
|
|
12
12
|
'building_name': "1-2",
|
|
13
13
|
'thoroughfare_name': "NURSERY",
|
|
14
14
|
'thoroughfare_descriptor': "LANE",
|
|
@@ -20,12 +20,12 @@ class TestExceptionI(unittest.TestCase):
|
|
|
20
20
|
def test_list(self):
|
|
21
21
|
"""Test conversion to an list"""
|
|
22
22
|
address = ["1-2 NURSERY LANE", "PENN", "HIGH WYCOMBE", "HP10 8LS"]
|
|
23
|
-
self.assertEqual(self.
|
|
23
|
+
self.assertEqual(self.address.list(), address, "Incorrect Exception I list format")
|
|
24
24
|
|
|
25
25
|
def test_string(self):
|
|
26
26
|
"""Test conversion to a string"""
|
|
27
27
|
address = "1-2 NURSERY LANE, PENN, HIGH WYCOMBE. HP10 8LS"
|
|
28
|
-
self.assertEqual(self.
|
|
28
|
+
self.assertEqual(self.address.str(), address, "Incorrect Exception I string format")
|
|
29
29
|
|
|
30
30
|
if __name__ == '__main__':
|
|
31
31
|
unittest.main()
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"""Test
|
|
1
|
+
"""Test Address Exception II formatting"""
|
|
2
2
|
|
|
3
3
|
import unittest
|
|
4
|
-
|
|
4
|
+
import paf
|
|
5
5
|
|
|
6
6
|
class TestExceptionII(unittest.TestCase):
|
|
7
|
-
"""Test
|
|
7
|
+
"""Test Address Exception II"""
|
|
8
8
|
|
|
9
9
|
def setUp(self):
|
|
10
|
-
"""Set up
|
|
11
|
-
self.
|
|
10
|
+
"""Set up Address instance"""
|
|
11
|
+
self.address = paf.Address({
|
|
12
12
|
'building_name': "12A",
|
|
13
13
|
'thoroughfare_name': "UPPERKIRKGATE",
|
|
14
14
|
'post_town': "ABERDEEN",
|
|
@@ -18,12 +18,12 @@ class TestExceptionII(unittest.TestCase):
|
|
|
18
18
|
def test_list(self):
|
|
19
19
|
"""Test conversion to an list"""
|
|
20
20
|
address = ["12A UPPERKIRKGATE", "ABERDEEN", "AB10 1BA"]
|
|
21
|
-
self.assertEqual(self.
|
|
21
|
+
self.assertEqual(self.address.list(), address, "Incorrect Exception II list format")
|
|
22
22
|
|
|
23
23
|
def test_string(self):
|
|
24
24
|
"""Test conversion to a string"""
|
|
25
25
|
address = "12A UPPERKIRKGATE, ABERDEEN. AB10 1BA"
|
|
26
|
-
self.assertEqual(self.
|
|
26
|
+
self.assertEqual(self.address.str(), address, "Incorrect Exception II string format")
|
|
27
27
|
|
|
28
28
|
if __name__ == '__main__':
|
|
29
29
|
unittest.main()
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"""Test
|
|
1
|
+
"""Test Address Exception III formatting"""
|
|
2
2
|
|
|
3
3
|
import unittest
|
|
4
|
-
|
|
4
|
+
import paf
|
|
5
5
|
|
|
6
6
|
class TestExceptionIII(unittest.TestCase):
|
|
7
|
-
"""Test
|
|
7
|
+
"""Test Address Exception III"""
|
|
8
8
|
|
|
9
9
|
def setUp(self):
|
|
10
|
-
"""Set up
|
|
11
|
-
self.
|
|
10
|
+
"""Set up Address instance"""
|
|
11
|
+
self.address = paf.Address({
|
|
12
12
|
'building_name': "K",
|
|
13
13
|
'thoroughfare_name': "PORTLAND",
|
|
14
14
|
'thoroughfare_descriptor': "ROAD",
|
|
@@ -19,12 +19,12 @@ class TestExceptionIII(unittest.TestCase):
|
|
|
19
19
|
def test_list(self):
|
|
20
20
|
"""Test conversion to an list"""
|
|
21
21
|
address = ["K PORTLAND ROAD", "DORKING", "RH4 1EW"]
|
|
22
|
-
self.assertEqual(self.
|
|
22
|
+
self.assertEqual(self.address.list(), address, "Incorrect Exception III list format")
|
|
23
23
|
|
|
24
24
|
def test_string(self):
|
|
25
25
|
"""Test conversion to a string"""
|
|
26
26
|
address = "K PORTLAND ROAD, DORKING. RH4 1EW"
|
|
27
|
-
self.assertEqual(self.
|
|
27
|
+
self.assertEqual(self.address.str(), address, "Incorrect Exception III string format")
|
|
28
28
|
|
|
29
29
|
if __name__ == '__main__':
|
|
30
30
|
unittest.main()
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""Test Address Exception IV formatting"""
|
|
2
|
+
|
|
3
|
+
import unittest
|
|
4
|
+
import paf
|
|
5
|
+
|
|
6
|
+
class TestExceptionIVUnit(unittest.TestCase):
|
|
7
|
+
"""Test Address Exception IV Unit"""
|
|
8
|
+
|
|
9
|
+
def setUp(self):
|
|
10
|
+
"""Set up Address instance"""
|
|
11
|
+
self.address = paf.Address({
|
|
12
|
+
'organisation_name': "THE TAMBOURINE WAREHOUSE",
|
|
13
|
+
'building_name': "UNIT 1-3",
|
|
14
|
+
'dependent_thoroughfare_name': "INDUSTRIAL",
|
|
15
|
+
'dependent_thoroughfare_descriptor': "ESTATE",
|
|
16
|
+
'thoroughfare_name': "TAME",
|
|
17
|
+
'thoroughfare_descriptor': "ROAD",
|
|
18
|
+
'post_town': "LONDON",
|
|
19
|
+
'postcode': "E6 7HS"
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
def test_list(self):
|
|
23
|
+
"""Test conversion to an list"""
|
|
24
|
+
address = [
|
|
25
|
+
"THE TAMBOURINE WAREHOUSE",
|
|
26
|
+
"UNIT 1-3",
|
|
27
|
+
"INDUSTRIAL ESTATE",
|
|
28
|
+
"TAME ROAD",
|
|
29
|
+
"LONDON",
|
|
30
|
+
"E6 7HS"
|
|
31
|
+
]
|
|
32
|
+
self.assertEqual(self.address.list(), address, "Incorrect Exception IV Unit list format")
|
|
33
|
+
|
|
34
|
+
def test_string(self):
|
|
35
|
+
"""Test conversion to a string"""
|
|
36
|
+
address = "THE TAMBOURINE WAREHOUSE, UNIT 1-3, INDUSTRIAL ESTATE, TAME ROAD, LONDON. E6 7HS"
|
|
37
|
+
self.assertEqual(self.address.str(), address, "Incorrect Exception IV Unit string format")
|
|
38
|
+
|
|
39
|
+
class TestExceptionIVStall(unittest.TestCase):
|
|
40
|
+
"""Test Address Exception IV Stall"""
|
|
41
|
+
|
|
42
|
+
def setUp(self):
|
|
43
|
+
"""Set up Address instance"""
|
|
44
|
+
self.address = paf.Address({
|
|
45
|
+
'organisation_name': "QUIRKY CANDLES LTD",
|
|
46
|
+
'building_name': "STALL 4",
|
|
47
|
+
'thoroughfare_name': "MARKET",
|
|
48
|
+
'thoroughfare_descriptor': "SQUARE",
|
|
49
|
+
'post_town': "LIVERPOOL",
|
|
50
|
+
'postcode': "L8 1LH"
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
def test_list(self):
|
|
54
|
+
"""Test conversion to an list"""
|
|
55
|
+
address = [
|
|
56
|
+
"QUIRKY CANDLES LTD",
|
|
57
|
+
"STALL 4",
|
|
58
|
+
"MARKET SQUARE",
|
|
59
|
+
"LIVERPOOL",
|
|
60
|
+
"L8 1LH"
|
|
61
|
+
]
|
|
62
|
+
self.assertEqual(self.address.list(), address, "Incorrect Exception IV Stall list format")
|
|
63
|
+
|
|
64
|
+
def test_string(self):
|
|
65
|
+
"""Test conversion to a string"""
|
|
66
|
+
address = "QUIRKY CANDLES LTD, STALL 4, MARKET SQUARE, LIVERPOOL. L8 1LH"
|
|
67
|
+
self.assertEqual(self.address.str(), address, "Incorrect Exception IV Stall string format")
|
|
68
|
+
|
|
69
|
+
class TestExceptionIVRearOf(unittest.TestCase):
|
|
70
|
+
"""Test Address Exception IV Rear Of"""
|
|
71
|
+
|
|
72
|
+
def setUp(self):
|
|
73
|
+
"""Set up Address instance"""
|
|
74
|
+
self.address = paf.Address({
|
|
75
|
+
'organisation_name': "FIONA'S FLOWERS",
|
|
76
|
+
'building_name': "REAR OF 5A",
|
|
77
|
+
'thoroughfare_name': "HIGH",
|
|
78
|
+
'thoroughfare_descriptor': "STREET",
|
|
79
|
+
'post_town': "GATESHEAD",
|
|
80
|
+
'postcode': "NE8 1BH"
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
def test_list(self):
|
|
84
|
+
"""Test conversion to an list"""
|
|
85
|
+
address = [
|
|
86
|
+
"FIONA'S FLOWERS",
|
|
87
|
+
"REAR OF 5A",
|
|
88
|
+
"HIGH STREET",
|
|
89
|
+
"GATESHEAD",
|
|
90
|
+
"NE8 1BH"
|
|
91
|
+
]
|
|
92
|
+
self.assertEqual(self.address.list(), address, "Incorrect Exception IV RearOf list format")
|
|
93
|
+
|
|
94
|
+
def test_string(self):
|
|
95
|
+
"""Test conversion to a string"""
|
|
96
|
+
address = "FIONA'S FLOWERS, REAR OF 5A, HIGH STREET, GATESHEAD. NE8 1BH"
|
|
97
|
+
self.assertEqual(self.address.str(), address, "Incorrect Exception IV RearOf string format")
|
|
98
|
+
|
|
99
|
+
if __name__ == '__main__':
|
|
100
|
+
unittest.main()
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"""Test
|
|
1
|
+
"""Test Address Mainfile formatting"""
|
|
2
2
|
|
|
3
3
|
import unittest
|
|
4
|
-
|
|
4
|
+
import paf
|
|
5
5
|
|
|
6
6
|
class TestMainfile(unittest.TestCase):
|
|
7
|
-
"""Test
|
|
7
|
+
"""Test Address Mainfile"""
|
|
8
8
|
|
|
9
9
|
def setUp(self):
|
|
10
|
-
"""Set up
|
|
11
|
-
self.
|
|
10
|
+
"""Set up Address instance"""
|
|
11
|
+
self.address = paf.Address({
|
|
12
12
|
'organisation_name': "SOUTH LANARKSHIRE COUNCIL",
|
|
13
13
|
'department_name': "HEAD START",
|
|
14
14
|
'sub_building_name': "UNIT 1",
|
|
@@ -34,7 +34,7 @@ class TestMainfile(unittest.TestCase):
|
|
|
34
34
|
"GLASGOW",
|
|
35
35
|
"G72 0UP"
|
|
36
36
|
]
|
|
37
|
-
self.assertEqual(self.
|
|
37
|
+
self.assertEqual(self.address.list(), address, "Incorrect Mainfile list format")
|
|
38
38
|
|
|
39
39
|
def test_string(self):
|
|
40
40
|
"""Test conversion to a string"""
|
|
@@ -49,7 +49,7 @@ class TestMainfile(unittest.TestCase):
|
|
|
49
49
|
"GLASGOW. "
|
|
50
50
|
"G72 0UP"
|
|
51
51
|
)
|
|
52
|
-
self.assertEqual(self.
|
|
52
|
+
self.assertEqual(self.address.str(), address, "Incorrect Mainfile string format")
|
|
53
53
|
|
|
54
54
|
if __name__ == '__main__':
|
|
55
55
|
unittest.main()
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"""Test
|
|
1
|
+
"""Test Address PO Box formatting"""
|
|
2
2
|
|
|
3
3
|
import unittest
|
|
4
|
-
|
|
4
|
+
import paf
|
|
5
5
|
|
|
6
6
|
class TestPoBox(unittest.TestCase):
|
|
7
|
-
"""Test
|
|
7
|
+
"""Test Address PO Box"""
|
|
8
8
|
|
|
9
9
|
def setUp(self):
|
|
10
|
-
"""Set up
|
|
11
|
-
self.
|
|
10
|
+
"""Set up Address instance"""
|
|
11
|
+
self.address = paf.Address({
|
|
12
12
|
'po_box_number': "61",
|
|
13
13
|
'post_town': "FAREHAM",
|
|
14
14
|
'postcode': "PO14 1UX"
|
|
@@ -17,12 +17,12 @@ class TestPoBox(unittest.TestCase):
|
|
|
17
17
|
def test_list(self):
|
|
18
18
|
"""Test conversion to an list"""
|
|
19
19
|
address = ["PO BOX 61", "FAREHAM", "PO14 1UX"]
|
|
20
|
-
self.assertEqual(self.
|
|
20
|
+
self.assertEqual(self.address.list(), address, "Incorrect PO Box list format")
|
|
21
21
|
|
|
22
22
|
def test_string(self):
|
|
23
23
|
"""Test conversion to a string"""
|
|
24
24
|
address = "PO BOX 61, FAREHAM. PO14 1UX"
|
|
25
|
-
self.assertEqual(self.
|
|
25
|
+
self.assertEqual(self.address.str(), address, "Incorrect PO Box string format")
|
|
26
26
|
|
|
27
27
|
if __name__ == '__main__':
|
|
28
28
|
unittest.main()
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"""Test
|
|
1
|
+
"""Test Address Rule 1 formatting"""
|
|
2
2
|
|
|
3
3
|
import unittest
|
|
4
|
-
|
|
4
|
+
import paf
|
|
5
5
|
|
|
6
6
|
class TestRule1(unittest.TestCase):
|
|
7
|
-
"""Test
|
|
7
|
+
"""Test Address Rule 1"""
|
|
8
8
|
|
|
9
9
|
def setUp(self):
|
|
10
|
-
"""Set up
|
|
11
|
-
self.
|
|
10
|
+
"""Set up Address instance"""
|
|
11
|
+
self.address = paf.Address({
|
|
12
12
|
'organisation_name': "LEDA ENGINEERING LTD",
|
|
13
13
|
'dependent_locality': "APPLEFORD",
|
|
14
14
|
'post_town': "ABINGDON",
|
|
@@ -18,12 +18,12 @@ class TestRule1(unittest.TestCase):
|
|
|
18
18
|
def test_list(self):
|
|
19
19
|
"""Test conversion to an list"""
|
|
20
20
|
address = ["LEDA ENGINEERING LTD", "APPLEFORD", "ABINGDON", "OX14 4PG"]
|
|
21
|
-
self.assertEqual(self.
|
|
21
|
+
self.assertEqual(self.address.list(), address, "Incorrect Rule 1 list format")
|
|
22
22
|
|
|
23
23
|
def test_string(self):
|
|
24
24
|
"""Test conversion to a string"""
|
|
25
25
|
address = "LEDA ENGINEERING LTD, APPLEFORD, ABINGDON. OX14 4PG"
|
|
26
|
-
self.assertEqual(self.
|
|
26
|
+
self.assertEqual(self.address.str(), address, "Incorrect Rule 1 string format")
|
|
27
27
|
|
|
28
28
|
if __name__ == '__main__':
|
|
29
29
|
unittest.main()
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"""Test
|
|
1
|
+
"""Test Address Rule 2 formatting"""
|
|
2
2
|
|
|
3
3
|
import unittest
|
|
4
|
-
|
|
4
|
+
import paf
|
|
5
5
|
|
|
6
6
|
class TestRule2(unittest.TestCase):
|
|
7
|
-
"""Test
|
|
7
|
+
"""Test Address Rule 2"""
|
|
8
8
|
|
|
9
9
|
def setUp(self):
|
|
10
|
-
"""Set up
|
|
11
|
-
self.
|
|
10
|
+
"""Set up Address instance"""
|
|
11
|
+
self.address = paf.Address({
|
|
12
12
|
'building_number': "1",
|
|
13
13
|
'thoroughfare_name': "ACACIA",
|
|
14
14
|
'thoroughfare_descriptor': "AVENUE",
|
|
@@ -19,12 +19,12 @@ class TestRule2(unittest.TestCase):
|
|
|
19
19
|
def test_list(self):
|
|
20
20
|
"""Test conversion to an list"""
|
|
21
21
|
address = ["1 ACACIA AVENUE", "ABINGDON", "OX14 4PG"]
|
|
22
|
-
self.assertEqual(self.
|
|
22
|
+
self.assertEqual(self.address.list(), address, "Incorrect Rule 2 list format")
|
|
23
23
|
|
|
24
24
|
def test_string(self):
|
|
25
25
|
"""Test conversion to a string"""
|
|
26
26
|
address = "1 ACACIA AVENUE, ABINGDON. OX14 4PG"
|
|
27
|
-
self.assertEqual(self.
|
|
27
|
+
self.assertEqual(self.address.str(), address, "Incorrect Rule 2 string format")
|
|
28
28
|
|
|
29
29
|
if __name__ == '__main__':
|
|
30
30
|
unittest.main()
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"""Test
|
|
1
|
+
"""Test Address Rule 3 formatting"""
|
|
2
2
|
|
|
3
3
|
import unittest
|
|
4
|
-
|
|
4
|
+
import paf
|
|
5
5
|
|
|
6
6
|
class TestRule3WithBuildingName(unittest.TestCase):
|
|
7
|
-
"""Test
|
|
7
|
+
"""Test Address Rule 3 with Building Name Exception"""
|
|
8
8
|
|
|
9
9
|
def setUp(self):
|
|
10
|
-
"""Set up
|
|
11
|
-
self.
|
|
10
|
+
"""Set up Address instance"""
|
|
11
|
+
self.address = paf.Address({
|
|
12
12
|
'building_name': "1A",
|
|
13
13
|
'dependent_thoroughfare_name': "SEASTONE",
|
|
14
14
|
'dependent_thoroughfare_descriptor': "COURT",
|
|
@@ -21,19 +21,19 @@ class TestRule3WithBuildingName(unittest.TestCase):
|
|
|
21
21
|
def test_list(self):
|
|
22
22
|
"""Test conversion to an list"""
|
|
23
23
|
address = ["1A SEASTONE COURT", "STATION ROAD", "HOLT", "NR25 7HG"]
|
|
24
|
-
self.assertEqual(self.
|
|
24
|
+
self.assertEqual(self.address.list(), address, "Incorrect Rule 3 w/ building list format")
|
|
25
25
|
|
|
26
26
|
def test_string(self):
|
|
27
27
|
"""Test conversion to a string"""
|
|
28
28
|
address = "1A SEASTONE COURT, STATION ROAD, HOLT. NR25 7HG"
|
|
29
|
-
self.assertEqual(self.
|
|
29
|
+
self.assertEqual(self.address.str(), address, "Incorrect Rule 3 w/ building string format")
|
|
30
30
|
|
|
31
31
|
class TestRule3WithoutBuildingName(unittest.TestCase):
|
|
32
|
-
"""Test
|
|
32
|
+
"""Test Address Rule 3 without Building Name Exception"""
|
|
33
33
|
|
|
34
34
|
def setUp(self):
|
|
35
|
-
"""Set up
|
|
36
|
-
self.
|
|
35
|
+
"""Set up Address instance"""
|
|
36
|
+
self.address = paf.Address({
|
|
37
37
|
'building_name': "THE MANOR",
|
|
38
38
|
'thoroughfare_name': "UPPER",
|
|
39
39
|
'thoroughfare_descriptor': "ROAD",
|
|
@@ -44,19 +44,19 @@ class TestRule3WithoutBuildingName(unittest.TestCase):
|
|
|
44
44
|
def test_list(self):
|
|
45
45
|
"""Test conversion to an list"""
|
|
46
46
|
address = ["THE MANOR", "UPPER ROAD", "HORLEY", "RH6 0HP"]
|
|
47
|
-
self.assertEqual(self.
|
|
47
|
+
self.assertEqual(self.address.list(), address, "Incorrect Rule 3 w/o building list format")
|
|
48
48
|
|
|
49
49
|
def test_string(self):
|
|
50
50
|
"""Test conversion to a string"""
|
|
51
51
|
address = "THE MANOR, UPPER ROAD, HORLEY. RH6 0HP"
|
|
52
|
-
self.assertEqual(self.
|
|
52
|
+
self.assertEqual(self.address.str(), address, "Incorrect Rule 3 w/ building string format")
|
|
53
53
|
|
|
54
54
|
class TestRule3WithSplit(unittest.TestCase):
|
|
55
|
-
"""Test
|
|
55
|
+
"""Test Address Rule 3 with Split Exception"""
|
|
56
56
|
|
|
57
57
|
def setUp(self):
|
|
58
|
-
"""Set up
|
|
59
|
-
self.
|
|
58
|
+
"""Set up Address instance"""
|
|
59
|
+
self.address = paf.Address({
|
|
60
60
|
'organisation_name': "S D ALCOTT FLORISTS",
|
|
61
61
|
'building_name': "FLOWER HOUSE 189A",
|
|
62
62
|
'thoroughfare_name': "PYE GREEN",
|
|
@@ -74,19 +74,19 @@ class TestRule3WithSplit(unittest.TestCase):
|
|
|
74
74
|
"CANNOCK",
|
|
75
75
|
"WS11 5SB"
|
|
76
76
|
]
|
|
77
|
-
self.assertEqual(self.
|
|
77
|
+
self.assertEqual(self.address.list(), address, "Incorrect Rule 3 with split list format")
|
|
78
78
|
|
|
79
79
|
def test_string(self):
|
|
80
80
|
"""Test conversion to a string"""
|
|
81
81
|
address = "S D ALCOTT FLORISTS, FLOWER HOUSE, 189A PYE GREEN ROAD, CANNOCK. WS11 5SB"
|
|
82
|
-
self.assertEqual(self.
|
|
82
|
+
self.assertEqual(self.address.str(), address, "Incorrect Rule 3 with split string format")
|
|
83
83
|
|
|
84
84
|
class TestRule3WithoutSplit(unittest.TestCase):
|
|
85
|
-
"""Test
|
|
85
|
+
"""Test Address Rule 3 without Split Exception"""
|
|
86
86
|
|
|
87
87
|
def setUp(self):
|
|
88
|
-
"""Set up
|
|
89
|
-
self.
|
|
88
|
+
"""Set up Address instance"""
|
|
89
|
+
self.address = paf.Address({
|
|
90
90
|
'organisation_name': "JAMES VILLA HOLIDAYS",
|
|
91
91
|
'building_name': "CENTRE 30",
|
|
92
92
|
'thoroughfare_name': "ST LAURENCE",
|
|
@@ -98,12 +98,12 @@ class TestRule3WithoutSplit(unittest.TestCase):
|
|
|
98
98
|
def test_list(self):
|
|
99
99
|
"""Test conversion to an list"""
|
|
100
100
|
address = ["JAMES VILLA HOLIDAYS", "CENTRE 30", "ST LAURENCE AVENUE", "GRAFTON", "ME16 0LP"]
|
|
101
|
-
self.assertEqual(self.
|
|
101
|
+
self.assertEqual(self.address.list(), address, "Incorrect Rule 3 w/o split list format")
|
|
102
102
|
|
|
103
103
|
def test_string(self):
|
|
104
104
|
"""Test conversion to a string"""
|
|
105
105
|
address = "JAMES VILLA HOLIDAYS, CENTRE 30, ST LAURENCE AVENUE, GRAFTON. ME16 0LP"
|
|
106
|
-
self.assertEqual(self.
|
|
106
|
+
self.assertEqual(self.address.str(), address, "Incorrect Rule 3 w/o split string format")
|
|
107
107
|
|
|
108
108
|
if __name__ == '__main__':
|
|
109
109
|
unittest.main()
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"""Test
|
|
1
|
+
"""Test Address Rule 4 formatting"""
|
|
2
2
|
|
|
3
3
|
import unittest
|
|
4
|
-
|
|
4
|
+
import paf
|
|
5
5
|
|
|
6
6
|
class TestRule4(unittest.TestCase):
|
|
7
|
-
"""Test
|
|
7
|
+
"""Test Address Rule 4"""
|
|
8
8
|
|
|
9
9
|
def setUp(self):
|
|
10
|
-
"""Set up
|
|
11
|
-
self.
|
|
10
|
+
"""Set up Address instance"""
|
|
11
|
+
self.address = paf.Address({
|
|
12
12
|
'building_name': "VICTORIA HOUSE",
|
|
13
13
|
'building_number': "15",
|
|
14
14
|
'thoroughfare_name': "THE",
|
|
@@ -20,12 +20,12 @@ class TestRule4(unittest.TestCase):
|
|
|
20
20
|
def test_list(self):
|
|
21
21
|
"""Test conversion to an list"""
|
|
22
22
|
address = ["VICTORIA HOUSE", "15 THE STREET", "CHRISTCHURCH", "BH23 6AA"]
|
|
23
|
-
self.assertEqual(self.
|
|
23
|
+
self.assertEqual(self.address.list(), address, "Incorrect Rule 4 list format")
|
|
24
24
|
|
|
25
25
|
def test_string(self):
|
|
26
26
|
"""Test conversion to a string"""
|
|
27
27
|
address = "VICTORIA HOUSE, 15 THE STREET, CHRISTCHURCH. BH23 6AA"
|
|
28
|
-
self.assertEqual(self.
|
|
28
|
+
self.assertEqual(self.address.str(), address, "Incorrect Rule 4 string format")
|
|
29
29
|
|
|
30
30
|
if __name__ == '__main__':
|
|
31
31
|
unittest.main()
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"""Test
|
|
1
|
+
"""Test Address Rule 5 formatting"""
|
|
2
2
|
|
|
3
3
|
import unittest
|
|
4
|
-
|
|
4
|
+
import paf
|
|
5
5
|
|
|
6
6
|
class TestRule5(unittest.TestCase):
|
|
7
|
-
"""Test
|
|
7
|
+
"""Test Address Rule 5"""
|
|
8
8
|
|
|
9
9
|
def setUp(self):
|
|
10
|
-
"""Set up
|
|
11
|
-
self.
|
|
10
|
+
"""Set up Address instance"""
|
|
11
|
+
self.address = paf.Address({
|
|
12
12
|
'sub_building_name': "FLAT 1",
|
|
13
13
|
'building_number': "12",
|
|
14
14
|
'thoroughfare_name': "LIME TREE",
|
|
@@ -20,19 +20,19 @@ class TestRule5(unittest.TestCase):
|
|
|
20
20
|
def test_list(self):
|
|
21
21
|
"""Test conversion to an list"""
|
|
22
22
|
address = ["FLAT 1", "12 LIME TREE AVENUE", "BRISTOL", "BS8 4AB"]
|
|
23
|
-
self.assertEqual(self.
|
|
23
|
+
self.assertEqual(self.address.list(), address, "Incorrect Rule 5 list format")
|
|
24
24
|
|
|
25
25
|
def test_string(self):
|
|
26
26
|
"""Test conversion to a string"""
|
|
27
27
|
address = "FLAT 1, 12 LIME TREE AVENUE, BRISTOL. BS8 4AB"
|
|
28
|
-
self.assertEqual(self.
|
|
28
|
+
self.assertEqual(self.address.str(), address, "Incorrect Rule 5 string format")
|
|
29
29
|
|
|
30
30
|
class TestRule5WithConcatenation(unittest.TestCase):
|
|
31
|
-
"""Test
|
|
31
|
+
"""Test Address Rule 5 with Concatenation"""
|
|
32
32
|
|
|
33
33
|
def setUp(self):
|
|
34
|
-
"""Set up
|
|
35
|
-
self.
|
|
34
|
+
"""Set up Address instance"""
|
|
35
|
+
self.address = paf.Address({
|
|
36
36
|
'sub_building_name': "A",
|
|
37
37
|
'building_number': "12",
|
|
38
38
|
'thoroughfare_name': "HIGH",
|
|
@@ -46,12 +46,16 @@ class TestRule5WithConcatenation(unittest.TestCase):
|
|
|
46
46
|
def test_list(self):
|
|
47
47
|
"""Test conversion to an list"""
|
|
48
48
|
address = ["12A HIGH STREET NORTH", "COOMBE BISSETT", "SALISBURY", "SP5 4NA"]
|
|
49
|
-
self.assertEqual(
|
|
49
|
+
self.assertEqual(
|
|
50
|
+
self.address.list(), address, "Incorrect Rule 5 with concatenate list format"
|
|
51
|
+
)
|
|
50
52
|
|
|
51
53
|
def test_string(self):
|
|
52
54
|
"""Test conversion to a string"""
|
|
53
55
|
address = "12A HIGH STREET NORTH, COOMBE BISSETT, SALISBURY. SP5 4NA"
|
|
54
|
-
self.assertEqual(
|
|
56
|
+
self.assertEqual(
|
|
57
|
+
self.address.str(), address, "Incorrect Rule 5 with concatenate string format"
|
|
58
|
+
)
|
|
55
59
|
|
|
56
60
|
if __name__ == '__main__':
|
|
57
61
|
unittest.main()
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"""Test
|
|
1
|
+
"""Test Address Rule 6 formatting"""
|
|
2
2
|
|
|
3
3
|
import unittest
|
|
4
|
-
|
|
4
|
+
import paf
|
|
5
5
|
|
|
6
6
|
class TestRule6WithSubBuildingName(unittest.TestCase):
|
|
7
|
-
"""Test
|
|
7
|
+
"""Test Address Rule 6 with Sub-Building Name Exception"""
|
|
8
8
|
|
|
9
9
|
def setUp(self):
|
|
10
|
-
"""Set up
|
|
11
|
-
self.
|
|
10
|
+
"""Set up Address instance"""
|
|
11
|
+
self.address = paf.Address({
|
|
12
12
|
'sub_building_name': "10B",
|
|
13
13
|
'building_name': "BARRY JACKSON TOWER",
|
|
14
14
|
'thoroughfare_name': "ESTONE",
|
|
@@ -20,19 +20,23 @@ class TestRule6WithSubBuildingName(unittest.TestCase):
|
|
|
20
20
|
def test_list(self):
|
|
21
21
|
"""Test conversion to an list"""
|
|
22
22
|
address = ["10B BARRY JACKSON TOWER", "ESTONE WALK", "BIRMINGHAM", "B6 5BA"]
|
|
23
|
-
self.assertEqual(
|
|
23
|
+
self.assertEqual(
|
|
24
|
+
self.address.list(), address, "Incorrect Rule 6 with sub-building list format"
|
|
25
|
+
)
|
|
24
26
|
|
|
25
27
|
def test_string(self):
|
|
26
28
|
"""Test conversion to a string"""
|
|
27
29
|
address = "10B BARRY JACKSON TOWER, ESTONE WALK, BIRMINGHAM. B6 5BA"
|
|
28
|
-
self.assertEqual(
|
|
30
|
+
self.assertEqual(
|
|
31
|
+
self.address.str(), address, "Incorrect Rule 6 with sub-building string format"
|
|
32
|
+
)
|
|
29
33
|
|
|
30
34
|
class TestRule6WithBuildingName(unittest.TestCase):
|
|
31
|
-
"""Test
|
|
35
|
+
"""Test Address Rule 6 with Building Name Exception"""
|
|
32
36
|
|
|
33
37
|
def setUp(self):
|
|
34
|
-
"""Set up
|
|
35
|
-
self.
|
|
38
|
+
"""Set up Address instance"""
|
|
39
|
+
self.address = paf.Address({
|
|
36
40
|
'sub_building_name': "CARETAKERS FLAT",
|
|
37
41
|
'building_name': "110-114",
|
|
38
42
|
'thoroughfare_name': "HIGH",
|
|
@@ -44,19 +48,19 @@ class TestRule6WithBuildingName(unittest.TestCase):
|
|
|
44
48
|
def test_list(self):
|
|
45
49
|
"""Test conversion to an list"""
|
|
46
50
|
address = ["CARETAKERS FLAT", "110-114 HIGH STREET WEST", "BRISTOL", "BS1 2AW"]
|
|
47
|
-
self.assertEqual(self.
|
|
51
|
+
self.assertEqual(self.address.list(), address, "Incorrect Rule 6 w/ building list format")
|
|
48
52
|
|
|
49
53
|
def test_string(self):
|
|
50
54
|
"""Test conversion to a string"""
|
|
51
55
|
address = "CARETAKERS FLAT, 110-114 HIGH STREET WEST, BRISTOL. BS1 2AW"
|
|
52
|
-
self.assertEqual(self.
|
|
56
|
+
self.assertEqual(self.address.str(), address, "Incorrect Rule 6 w/ building string format")
|
|
53
57
|
|
|
54
58
|
class TestRule6(unittest.TestCase):
|
|
55
|
-
"""Test
|
|
59
|
+
"""Test Address Rule 6 without Exception"""
|
|
56
60
|
|
|
57
61
|
def setUp(self):
|
|
58
|
-
"""Set up
|
|
59
|
-
self.
|
|
62
|
+
"""Set up Address instance"""
|
|
63
|
+
self.address = paf.Address({
|
|
60
64
|
'sub_building_name': "STABLES FLAT",
|
|
61
65
|
'building_name': "THE MANOR",
|
|
62
66
|
'thoroughfare_name': "UPPER",
|
|
@@ -68,12 +72,12 @@ class TestRule6(unittest.TestCase):
|
|
|
68
72
|
def test_list(self):
|
|
69
73
|
"""Test conversion to an list"""
|
|
70
74
|
address = ["STABLES FLAT", "THE MANOR", "UPPER HILL", "HORLEY", "RH6 0HP"]
|
|
71
|
-
self.assertEqual(self.
|
|
75
|
+
self.assertEqual(self.address.list(), address, "Incorrect Rule 6 list format")
|
|
72
76
|
|
|
73
77
|
def test_string(self):
|
|
74
78
|
"""Test conversion to a string"""
|
|
75
79
|
address = "STABLES FLAT, THE MANOR, UPPER HILL, HORLEY. RH6 0HP"
|
|
76
|
-
self.assertEqual(self.
|
|
80
|
+
self.assertEqual(self.address.str(), address, "Incorrect Rule 6 string format")
|
|
77
81
|
|
|
78
82
|
if __name__ == '__main__':
|
|
79
83
|
unittest.main()
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"""Test Address Rule 7 formatting"""
|
|
2
|
+
|
|
3
|
+
import unittest
|
|
4
|
+
import paf
|
|
5
|
+
|
|
6
|
+
class TestRule7WithZeroBuildingNumber(unittest.TestCase):
|
|
7
|
+
"""Test Address Rule 7 with a 0 Building Number"""
|
|
8
|
+
|
|
9
|
+
def setUp(self):
|
|
10
|
+
"""Set up Address instance"""
|
|
11
|
+
self.address = paf.Address({
|
|
12
|
+
'sub_building_name': "FLAT 1",
|
|
13
|
+
'building_name': "HOLLY HOUSE",
|
|
14
|
+
'building_number': "0",
|
|
15
|
+
'thoroughfare_name': "OAK",
|
|
16
|
+
'thoroughfare_descriptor': "AVENUE",
|
|
17
|
+
'dependent_locality': "BIDDENDEN",
|
|
18
|
+
'post_town': "ASHFORD",
|
|
19
|
+
'postcode': "TN27 8BT"
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
def test_list(self):
|
|
23
|
+
"""Test conversion to an list"""
|
|
24
|
+
address = ["FLAT 1, HOLLY HOUSE", "OAK AVENUE", "BIDDENDEN", "ASHFORD", "TN27 8BT"]
|
|
25
|
+
self.assertEqual(
|
|
26
|
+
self.address.list(), address, "Incorrect Rule 7 with 0 building number format"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
def test_string(self):
|
|
30
|
+
"""Test conversion to a string"""
|
|
31
|
+
address = "FLAT 1, HOLLY HOUSE, OAK AVENUE, BIDDENDEN, ASHFORD. TN27 8BT"
|
|
32
|
+
self.assertEqual(
|
|
33
|
+
self.address.str(), address, "Incorrect Rule 7 with 0 building number format"
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
class TestRule7WithSubBuildingName(unittest.TestCase):
|
|
37
|
+
"""Test Address Rule 7 with Sub-Building Name Exception"""
|
|
38
|
+
|
|
39
|
+
def setUp(self):
|
|
40
|
+
"""Set up Address instance"""
|
|
41
|
+
self.address = paf.Address({
|
|
42
|
+
'sub_building_name': "2B",
|
|
43
|
+
'building_name': "THE TOWER",
|
|
44
|
+
'building_number': "27",
|
|
45
|
+
'thoroughfare_name': "JOHN",
|
|
46
|
+
'thoroughfare_descriptor': "STREET",
|
|
47
|
+
'post_town': "WINCHESTER",
|
|
48
|
+
'postcode': "SO23 9AP"
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
def test_list(self):
|
|
52
|
+
"""Test conversion to an list"""
|
|
53
|
+
address = ["2B THE TOWER", "27 JOHN STREET", "WINCHESTER", "SO23 9AP"]
|
|
54
|
+
self.assertEqual(
|
|
55
|
+
self.address.list(), address, "Incorrect Rule 7 with sub-building list format"
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
def test_string(self):
|
|
59
|
+
"""Test conversion to a string"""
|
|
60
|
+
address = "2B THE TOWER, 27 JOHN STREET, WINCHESTER. SO23 9AP"
|
|
61
|
+
self.assertEqual(
|
|
62
|
+
self.address.str(), address, "Incorrect Rule 7 with sub-building string format"
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
class TestRule7(unittest.TestCase):
|
|
66
|
+
"""Test Address Rule 7 without Exception"""
|
|
67
|
+
|
|
68
|
+
def setUp(self):
|
|
69
|
+
"""Set up Address instance"""
|
|
70
|
+
self.address = paf.Address({
|
|
71
|
+
'sub_building_name': "BASEMENT FLAT",
|
|
72
|
+
'building_name': "VICTORIA HOUSE",
|
|
73
|
+
'building_number': "15",
|
|
74
|
+
'thoroughfare_name': "THE",
|
|
75
|
+
'thoroughfare_descriptor': "STREET",
|
|
76
|
+
'post_town': "CORYTON",
|
|
77
|
+
'postcode': "BP23 6AA"
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
def test_list(self):
|
|
81
|
+
"""Test conversion to an list"""
|
|
82
|
+
address = ["BASEMENT FLAT", "VICTORIA HOUSE", "15 THE STREET", "CORYTON", "BP23 6AA"]
|
|
83
|
+
self.assertEqual(self.address.list(), address, "Incorrect Rule 7 list format")
|
|
84
|
+
|
|
85
|
+
def test_string(self):
|
|
86
|
+
"""Test conversion to a string"""
|
|
87
|
+
address = "BASEMENT FLAT, VICTORIA HOUSE, 15 THE STREET, CORYTON. BP23 6AA"
|
|
88
|
+
self.assertEqual(self.address.str(), address, "Incorrect Rule 7 string format")
|
|
89
|
+
|
|
90
|
+
if __name__ == '__main__':
|
|
91
|
+
unittest.main()
|
pypaf-0.2.0/src/paf/__init__.py
DELETED
pypaf-0.2.0/src/paf/version.py
DELETED
pypaf-0.2.0/tests/test_rule_7.py
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"""Test Paf Rule 7 formatting"""
|
|
2
|
-
|
|
3
|
-
import unittest
|
|
4
|
-
from paf import Paf
|
|
5
|
-
|
|
6
|
-
class TestRule7WithSubBuildingName(unittest.TestCase):
|
|
7
|
-
"""Test Paf Rule 7 with Sub-Building Name Exception"""
|
|
8
|
-
|
|
9
|
-
def setUp(self):
|
|
10
|
-
"""Set up Paf instance"""
|
|
11
|
-
self.paf = Paf({
|
|
12
|
-
'sub_building_name': "2B",
|
|
13
|
-
'building_name': "THE TOWER",
|
|
14
|
-
'building_number': "27",
|
|
15
|
-
'thoroughfare_name': "JOHN",
|
|
16
|
-
'thoroughfare_descriptor': "STREET",
|
|
17
|
-
'post_town': "WINCHESTER",
|
|
18
|
-
'postcode': "SO23 9AP"
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
def test_list(self):
|
|
22
|
-
"""Test conversion to an list"""
|
|
23
|
-
address = ["2B THE TOWER", "27 JOHN STREET", "WINCHESTER", "SO23 9AP"]
|
|
24
|
-
self.assertEqual(self.paf.list(), address, "Incorrect Rule 7 with sub-building list format")
|
|
25
|
-
|
|
26
|
-
def test_string(self):
|
|
27
|
-
"""Test conversion to a string"""
|
|
28
|
-
address = "2B THE TOWER, 27 JOHN STREET, WINCHESTER. SO23 9AP"
|
|
29
|
-
self.assertEqual(self.paf.str(), address, "Incorrect Rule 7 w/ sub-building string format")
|
|
30
|
-
|
|
31
|
-
class TestRule7(unittest.TestCase):
|
|
32
|
-
"""Test Paf Rule 7 without Exception"""
|
|
33
|
-
|
|
34
|
-
def setUp(self):
|
|
35
|
-
"""Set up Paf instance"""
|
|
36
|
-
self.paf = Paf({
|
|
37
|
-
'sub_building_name': "BASEMENT FLAT",
|
|
38
|
-
'building_name': "VICTORIA HOUSE",
|
|
39
|
-
'building_number': "15",
|
|
40
|
-
'thoroughfare_name': "THE",
|
|
41
|
-
'thoroughfare_descriptor': "STREET",
|
|
42
|
-
'post_town': "CORYTON",
|
|
43
|
-
'postcode': "BP23 6AA"
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
def test_list(self):
|
|
47
|
-
"""Test conversion to an list"""
|
|
48
|
-
address = ["BASEMENT FLAT", "VICTORIA HOUSE", "15 THE STREET", "CORYTON", "BP23 6AA"]
|
|
49
|
-
self.assertEqual(self.paf.list(), address, "Incorrect Rule 7 list format")
|
|
50
|
-
|
|
51
|
-
def test_string(self):
|
|
52
|
-
"""Test conversion to a string"""
|
|
53
|
-
address = "BASEMENT FLAT, VICTORIA HOUSE, 15 THE STREET, CORYTON. BP23 6AA"
|
|
54
|
-
self.assertEqual(self.paf.str(), address, "Incorrect Rule 7 string format")
|
|
55
|
-
|
|
56
|
-
if __name__ == '__main__':
|
|
57
|
-
unittest.main()
|
|
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
|