PyPaf 0.1.0__tar.gz → 0.3.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.1.0/src/PyPaf.egg-info → pypaf-0.3.0}/PKG-INFO +5 -5
- {pypaf-0.1.0 → pypaf-0.3.0}/README.md +4 -4
- {pypaf-0.1.0 → pypaf-0.3.0/src/PyPaf.egg-info}/PKG-INFO +5 -5
- {pypaf-0.1.0 → pypaf-0.3.0}/src/PyPaf.egg-info/SOURCES.txt +1 -0
- {pypaf-0.1.0 → pypaf-0.3.0}/src/paf/paf.py +12 -4
- {pypaf-0.1.0 → pypaf-0.3.0}/src/paf/premises/rule010.py +10 -1
- {pypaf-0.1.0 → pypaf-0.3.0}/src/paf/premises/rule111.py +13 -1
- pypaf-0.3.0/src/paf/version.py +3 -0
- {pypaf-0.1.0 → pypaf-0.3.0}/tests/test_exception_i.py +1 -1
- {pypaf-0.1.0 → pypaf-0.3.0}/tests/test_exception_ii.py +1 -1
- {pypaf-0.1.0 → pypaf-0.3.0}/tests/test_exception_iii.py +1 -1
- pypaf-0.3.0/tests/test_exception_iv.py +100 -0
- {pypaf-0.1.0 → pypaf-0.3.0}/tests/test_mainfile.py +1 -1
- {pypaf-0.1.0 → pypaf-0.3.0}/tests/test_po_box.py +1 -1
- {pypaf-0.1.0 → pypaf-0.3.0}/tests/test_rule_1.py +1 -1
- {pypaf-0.1.0 → pypaf-0.3.0}/tests/test_rule_2.py +1 -1
- {pypaf-0.1.0 → pypaf-0.3.0}/tests/test_rule_3.py +4 -4
- {pypaf-0.1.0 → pypaf-0.3.0}/tests/test_rule_4.py +1 -1
- {pypaf-0.1.0 → pypaf-0.3.0}/tests/test_rule_5.py +2 -2
- {pypaf-0.1.0 → pypaf-0.3.0}/tests/test_rule_6.py +3 -3
- {pypaf-0.1.0 → pypaf-0.3.0}/tests/test_rule_7.py +28 -2
- pypaf-0.1.0/src/paf/version.py +0 -3
- {pypaf-0.1.0 → pypaf-0.3.0}/LICENSE.txt +0 -0
- {pypaf-0.1.0 → pypaf-0.3.0}/pyproject.toml +0 -0
- {pypaf-0.1.0 → pypaf-0.3.0}/setup.cfg +0 -0
- {pypaf-0.1.0 → pypaf-0.3.0}/src/PyPaf.egg-info/dependency_links.txt +0 -0
- {pypaf-0.1.0 → pypaf-0.3.0}/src/PyPaf.egg-info/top_level.txt +0 -0
- {pypaf-0.1.0 → pypaf-0.3.0}/src/paf/__init__.py +0 -0
- {pypaf-0.1.0 → pypaf-0.3.0}/src/paf/attribute.py +0 -0
- {pypaf-0.1.0 → pypaf-0.3.0}/src/paf/lineable.py +0 -0
- {pypaf-0.1.0 → pypaf-0.3.0}/src/paf/premises/__init__.py +0 -0
- {pypaf-0.1.0 → pypaf-0.3.0}/src/paf/premises/common.py +0 -0
- {pypaf-0.1.0 → pypaf-0.3.0}/src/paf/premises/rule000.py +0 -0
- {pypaf-0.1.0 → pypaf-0.3.0}/src/paf/premises/rule001.py +0 -0
- {pypaf-0.1.0 → pypaf-0.3.0}/src/paf/premises/rule011.py +0 -0
- {pypaf-0.1.0 → pypaf-0.3.0}/src/paf/premises/rule101.py +0 -0
- {pypaf-0.1.0 → pypaf-0.3.0}/src/paf/premises/rule110.py +0 -0
- {pypaf-0.1.0 → pypaf-0.3.0}/src/paf/premises_extender.py +0 -0
- {pypaf-0.1.0 → pypaf-0.3.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.3.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,13 +15,13 @@ 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
|
|
|
22
22
|
Install it from PyPI:
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
pip install pypaf
|
|
25
25
|
|
|
26
26
|
## Usage
|
|
27
27
|
|
|
@@ -37,7 +37,7 @@ paf = Paf({
|
|
|
37
37
|
'post_town': "HIGH WYCOMBE",
|
|
38
38
|
'postcode': "HP10 8LS"
|
|
39
39
|
})
|
|
40
|
-
paf.list()
|
|
40
|
+
paf.list() # or list(paf)
|
|
41
41
|
|
|
42
42
|
['1-2 NURSERY LANE', 'PENN', 'HIGH WYCOMBE', 'HP10 8LS']
|
|
43
43
|
```
|
|
@@ -54,7 +54,7 @@ paf = Paf({
|
|
|
54
54
|
'post_town': "HIGH WYCOMBE",
|
|
55
55
|
'postcode': "HP10 8LS"
|
|
56
56
|
})
|
|
57
|
-
str(paf)
|
|
57
|
+
paf.str() # or str(paf)
|
|
58
58
|
|
|
59
59
|
'1-2 NURSERY LANE, PENN, HIGH WYCOMBE. HP10 8LS'
|
|
60
60
|
```
|
|
@@ -1,12 +1,12 @@
|
|
|
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
|
|
|
7
7
|
Install it from PyPI:
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
pip install pypaf
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
@@ -22,7 +22,7 @@ paf = Paf({
|
|
|
22
22
|
'post_town': "HIGH WYCOMBE",
|
|
23
23
|
'postcode': "HP10 8LS"
|
|
24
24
|
})
|
|
25
|
-
paf.list()
|
|
25
|
+
paf.list() # or list(paf)
|
|
26
26
|
|
|
27
27
|
['1-2 NURSERY LANE', 'PENN', 'HIGH WYCOMBE', 'HP10 8LS']
|
|
28
28
|
```
|
|
@@ -39,7 +39,7 @@ paf = Paf({
|
|
|
39
39
|
'post_town': "HIGH WYCOMBE",
|
|
40
40
|
'postcode': "HP10 8LS"
|
|
41
41
|
})
|
|
42
|
-
str(paf)
|
|
42
|
+
paf.str() # or str(paf)
|
|
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.3.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,13 +15,13 @@ 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
|
|
|
22
22
|
Install it from PyPI:
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
pip install pypaf
|
|
25
25
|
|
|
26
26
|
## Usage
|
|
27
27
|
|
|
@@ -37,7 +37,7 @@ paf = Paf({
|
|
|
37
37
|
'post_town': "HIGH WYCOMBE",
|
|
38
38
|
'postcode': "HP10 8LS"
|
|
39
39
|
})
|
|
40
|
-
paf.list()
|
|
40
|
+
paf.list() # or list(paf)
|
|
41
41
|
|
|
42
42
|
['1-2 NURSERY LANE', 'PENN', 'HIGH WYCOMBE', 'HP10 8LS']
|
|
43
43
|
```
|
|
@@ -54,7 +54,7 @@ paf = Paf({
|
|
|
54
54
|
'post_town': "HIGH WYCOMBE",
|
|
55
55
|
'postcode': "HP10 8LS"
|
|
56
56
|
})
|
|
57
|
-
str(paf)
|
|
57
|
+
paf.str() # or str(paf)
|
|
58
58
|
|
|
59
59
|
'1-2 NURSERY LANE, PENN, HIGH WYCOMBE. HP10 8LS'
|
|
60
60
|
```
|
|
@@ -20,14 +20,22 @@ class Paf(LineableMixin):
|
|
|
20
20
|
return self.__class__.__name__ + '(' + str(args) + ')'
|
|
21
21
|
|
|
22
22
|
def __str__(self):
|
|
23
|
-
"""Return Paf as string"""
|
|
23
|
+
"""Return Paf 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
|
+
def __iter__(self):
|
|
30
|
+
"""Return Paf as iterable"""
|
|
31
|
+
yield from self.lines.__iter__()
|
|
32
|
+
if not self.is_empty('postcode'):
|
|
33
|
+
yield from [getattr(self, 'postcode')].__iter__()
|
|
34
|
+
|
|
35
|
+
def str(self):
|
|
36
|
+
"""Return Paf as string"""
|
|
37
|
+
return str(self)
|
|
38
|
+
|
|
29
39
|
def list(self):
|
|
30
40
|
"""Return Paf as list of strings"""
|
|
31
|
-
|
|
32
|
-
return self.lines
|
|
33
|
-
return self.lines + [getattr(self, 'postcode')]
|
|
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'], ', ')
|
|
@@ -25,7 +25,7 @@ class TestExceptionI(unittest.TestCase):
|
|
|
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(
|
|
28
|
+
self.assertEqual(self.paf.str(), address, "Incorrect Exception I string format")
|
|
29
29
|
|
|
30
30
|
if __name__ == '__main__':
|
|
31
31
|
unittest.main()
|
|
@@ -23,7 +23,7 @@ class TestExceptionII(unittest.TestCase):
|
|
|
23
23
|
def test_string(self):
|
|
24
24
|
"""Test conversion to a string"""
|
|
25
25
|
address = "12A UPPERKIRKGATE, ABERDEEN. AB10 1BA"
|
|
26
|
-
self.assertEqual(
|
|
26
|
+
self.assertEqual(self.paf.str(), address, "Incorrect Exception II string format")
|
|
27
27
|
|
|
28
28
|
if __name__ == '__main__':
|
|
29
29
|
unittest.main()
|
|
@@ -24,7 +24,7 @@ class TestExceptionIII(unittest.TestCase):
|
|
|
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(
|
|
27
|
+
self.assertEqual(self.paf.str(), address, "Incorrect Exception III string format")
|
|
28
28
|
|
|
29
29
|
if __name__ == '__main__':
|
|
30
30
|
unittest.main()
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""Test Paf Exception IV formatting"""
|
|
2
|
+
|
|
3
|
+
import unittest
|
|
4
|
+
from paf import Paf
|
|
5
|
+
|
|
6
|
+
class TestExceptionIVUnit(unittest.TestCase):
|
|
7
|
+
"""Test Paf Exception IV Unit"""
|
|
8
|
+
|
|
9
|
+
def setUp(self):
|
|
10
|
+
"""Set up Paf instance"""
|
|
11
|
+
self.paf = Paf({
|
|
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.paf.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.paf.str(), address, "Incorrect Exception IV Unit string format")
|
|
38
|
+
|
|
39
|
+
class TestExceptionIVStall(unittest.TestCase):
|
|
40
|
+
"""Test Paf Exception IV Stall"""
|
|
41
|
+
|
|
42
|
+
def setUp(self):
|
|
43
|
+
"""Set up Paf instance"""
|
|
44
|
+
self.paf = Paf({
|
|
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.paf.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.paf.str(), address, "Incorrect Exception IV Stall string format")
|
|
68
|
+
|
|
69
|
+
class TestExceptionIVRearOf(unittest.TestCase):
|
|
70
|
+
"""Test Paf Exception IV Rear Of"""
|
|
71
|
+
|
|
72
|
+
def setUp(self):
|
|
73
|
+
"""Set up Paf instance"""
|
|
74
|
+
self.paf = Paf({
|
|
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.paf.list(), address, "Incorrect Exception IV Rear Of 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.paf.str(), address, "Incorrect Exception IV Rear Of string format")
|
|
98
|
+
|
|
99
|
+
if __name__ == '__main__':
|
|
100
|
+
unittest.main()
|
|
@@ -49,7 +49,7 @@ class TestMainfile(unittest.TestCase):
|
|
|
49
49
|
"GLASGOW. "
|
|
50
50
|
"G72 0UP"
|
|
51
51
|
)
|
|
52
|
-
self.assertEqual(
|
|
52
|
+
self.assertEqual(self.paf.str(), address, "Incorrect Mainfile string format")
|
|
53
53
|
|
|
54
54
|
if __name__ == '__main__':
|
|
55
55
|
unittest.main()
|
|
@@ -22,7 +22,7 @@ class TestPoBox(unittest.TestCase):
|
|
|
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(
|
|
25
|
+
self.assertEqual(self.paf.str(), address, "Incorrect PO Box string format")
|
|
26
26
|
|
|
27
27
|
if __name__ == '__main__':
|
|
28
28
|
unittest.main()
|
|
@@ -23,7 +23,7 @@ class TestRule1(unittest.TestCase):
|
|
|
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(
|
|
26
|
+
self.assertEqual(self.paf.str(), address, "Incorrect Rule 1 string format")
|
|
27
27
|
|
|
28
28
|
if __name__ == '__main__':
|
|
29
29
|
unittest.main()
|
|
@@ -24,7 +24,7 @@ class TestRule2(unittest.TestCase):
|
|
|
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(
|
|
27
|
+
self.assertEqual(self.paf.str(), address, "Incorrect Rule 2 string format")
|
|
28
28
|
|
|
29
29
|
if __name__ == '__main__':
|
|
30
30
|
unittest.main()
|
|
@@ -26,7 +26,7 @@ class TestRule3WithBuildingName(unittest.TestCase):
|
|
|
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(
|
|
29
|
+
self.assertEqual(self.paf.str(), address, "Incorrect Rule 3 with building string format")
|
|
30
30
|
|
|
31
31
|
class TestRule3WithoutBuildingName(unittest.TestCase):
|
|
32
32
|
"""Test Paf Rule 3 without Building Name Exception"""
|
|
@@ -49,7 +49,7 @@ class TestRule3WithoutBuildingName(unittest.TestCase):
|
|
|
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(
|
|
52
|
+
self.assertEqual(self.paf.str(), address, "Incorrect Rule 3 without building string format")
|
|
53
53
|
|
|
54
54
|
class TestRule3WithSplit(unittest.TestCase):
|
|
55
55
|
"""Test Paf Rule 3 with Split Exception"""
|
|
@@ -79,7 +79,7 @@ class TestRule3WithSplit(unittest.TestCase):
|
|
|
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(
|
|
82
|
+
self.assertEqual(self.paf.str(), address, "Incorrect Rule 3 with split string format")
|
|
83
83
|
|
|
84
84
|
class TestRule3WithoutSplit(unittest.TestCase):
|
|
85
85
|
"""Test Paf Rule 3 without Split Exception"""
|
|
@@ -103,7 +103,7 @@ class TestRule3WithoutSplit(unittest.TestCase):
|
|
|
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(
|
|
106
|
+
self.assertEqual(self.paf.str(), address, "Incorrect Rule 3 without split string format")
|
|
107
107
|
|
|
108
108
|
if __name__ == '__main__':
|
|
109
109
|
unittest.main()
|
|
@@ -25,7 +25,7 @@ class TestRule4(unittest.TestCase):
|
|
|
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(
|
|
28
|
+
self.assertEqual(self.paf.str(), address, "Incorrect Rule 4 string format")
|
|
29
29
|
|
|
30
30
|
if __name__ == '__main__':
|
|
31
31
|
unittest.main()
|
|
@@ -25,7 +25,7 @@ class TestRule5(unittest.TestCase):
|
|
|
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(
|
|
28
|
+
self.assertEqual(self.paf.str(), address, "Incorrect Rule 5 string format")
|
|
29
29
|
|
|
30
30
|
class TestRule5WithConcatenation(unittest.TestCase):
|
|
31
31
|
"""Test Paf Rule 5 with Concatenation"""
|
|
@@ -51,7 +51,7 @@ class TestRule5WithConcatenation(unittest.TestCase):
|
|
|
51
51
|
def test_string(self):
|
|
52
52
|
"""Test conversion to a string"""
|
|
53
53
|
address = "12A HIGH STREET NORTH, COOMBE BISSETT, SALISBURY. SP5 4NA"
|
|
54
|
-
self.assertEqual(
|
|
54
|
+
self.assertEqual(self.paf.str(), address, "Incorrect Rule 5 with concatenate string format")
|
|
55
55
|
|
|
56
56
|
if __name__ == '__main__':
|
|
57
57
|
unittest.main()
|
|
@@ -25,7 +25,7 @@ class TestRule6WithSubBuildingName(unittest.TestCase):
|
|
|
25
25
|
def test_string(self):
|
|
26
26
|
"""Test conversion to a string"""
|
|
27
27
|
address = "10B BARRY JACKSON TOWER, ESTONE WALK, BIRMINGHAM. B6 5BA"
|
|
28
|
-
self.assertEqual(
|
|
28
|
+
self.assertEqual(self.paf.str(), address, "Incorrect Rule 6 w/ sub-building string format")
|
|
29
29
|
|
|
30
30
|
class TestRule6WithBuildingName(unittest.TestCase):
|
|
31
31
|
"""Test Paf Rule 6 with Building Name Exception"""
|
|
@@ -49,7 +49,7 @@ class TestRule6WithBuildingName(unittest.TestCase):
|
|
|
49
49
|
def test_string(self):
|
|
50
50
|
"""Test conversion to a string"""
|
|
51
51
|
address = "CARETAKERS FLAT, 110-114 HIGH STREET WEST, BRISTOL. BS1 2AW"
|
|
52
|
-
self.assertEqual(
|
|
52
|
+
self.assertEqual(self.paf.str(), address, "Incorrect Rule 6 with building string format")
|
|
53
53
|
|
|
54
54
|
class TestRule6(unittest.TestCase):
|
|
55
55
|
"""Test Paf Rule 6 without Exception"""
|
|
@@ -73,7 +73,7 @@ class TestRule6(unittest.TestCase):
|
|
|
73
73
|
def test_string(self):
|
|
74
74
|
"""Test conversion to a string"""
|
|
75
75
|
address = "STABLES FLAT, THE MANOR, UPPER HILL, HORLEY. RH6 0HP"
|
|
76
|
-
self.assertEqual(
|
|
76
|
+
self.assertEqual(self.paf.str(), address, "Incorrect Rule 6 string format")
|
|
77
77
|
|
|
78
78
|
if __name__ == '__main__':
|
|
79
79
|
unittest.main()
|
|
@@ -3,6 +3,32 @@
|
|
|
3
3
|
import unittest
|
|
4
4
|
from paf import Paf
|
|
5
5
|
|
|
6
|
+
class TestRule7WithZeroBuildingNumber(unittest.TestCase):
|
|
7
|
+
"""Test Paf Rule 7 with a 0 Building Number"""
|
|
8
|
+
|
|
9
|
+
def setUp(self):
|
|
10
|
+
"""Set up Paf instance"""
|
|
11
|
+
self.paf = Paf({
|
|
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(self.paf.list(), address, "Incorrect Rule 7 with 0 building number format")
|
|
26
|
+
|
|
27
|
+
def test_string(self):
|
|
28
|
+
"""Test conversion to a string"""
|
|
29
|
+
address = "FLAT 1, HOLLY HOUSE, OAK AVENUE, BIDDENDEN, ASHFORD. TN27 8BT"
|
|
30
|
+
self.assertEqual(self.paf.str(), address, "Incorrect Rule 7 w/ 0 building number format")
|
|
31
|
+
|
|
6
32
|
class TestRule7WithSubBuildingName(unittest.TestCase):
|
|
7
33
|
"""Test Paf Rule 7 with Sub-Building Name Exception"""
|
|
8
34
|
|
|
@@ -26,7 +52,7 @@ class TestRule7WithSubBuildingName(unittest.TestCase):
|
|
|
26
52
|
def test_string(self):
|
|
27
53
|
"""Test conversion to a string"""
|
|
28
54
|
address = "2B THE TOWER, 27 JOHN STREET, WINCHESTER. SO23 9AP"
|
|
29
|
-
self.assertEqual(
|
|
55
|
+
self.assertEqual(self.paf.str(), address, "Incorrect Rule 7 w/ sub-building string format")
|
|
30
56
|
|
|
31
57
|
class TestRule7(unittest.TestCase):
|
|
32
58
|
"""Test Paf Rule 7 without Exception"""
|
|
@@ -51,7 +77,7 @@ class TestRule7(unittest.TestCase):
|
|
|
51
77
|
def test_string(self):
|
|
52
78
|
"""Test conversion to a string"""
|
|
53
79
|
address = "BASEMENT FLAT, VICTORIA HOUSE, 15 THE STREET, CORYTON. BP23 6AA"
|
|
54
|
-
self.assertEqual(
|
|
80
|
+
self.assertEqual(self.paf.str(), address, "Incorrect Rule 7 string format")
|
|
55
81
|
|
|
56
82
|
if __name__ == '__main__':
|
|
57
83
|
unittest.main()
|
pypaf-0.1.0/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
|