PyPaf 0.2.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.
Files changed (39) hide show
  1. {pypaf-0.2.0/src/PyPaf.egg-info → pypaf-0.3.0}/PKG-INFO +2 -2
  2. {pypaf-0.2.0 → pypaf-0.3.0}/README.md +1 -1
  3. {pypaf-0.2.0 → pypaf-0.3.0/src/PyPaf.egg-info}/PKG-INFO +2 -2
  4. {pypaf-0.2.0 → pypaf-0.3.0}/src/PyPaf.egg-info/SOURCES.txt +1 -0
  5. {pypaf-0.2.0 → pypaf-0.3.0}/src/paf/premises/rule010.py +10 -1
  6. {pypaf-0.2.0 → pypaf-0.3.0}/src/paf/premises/rule111.py +13 -1
  7. pypaf-0.3.0/src/paf/version.py +3 -0
  8. pypaf-0.3.0/tests/test_exception_iv.py +100 -0
  9. {pypaf-0.2.0 → pypaf-0.3.0}/tests/test_rule_7.py +26 -0
  10. pypaf-0.2.0/src/paf/version.py +0 -3
  11. {pypaf-0.2.0 → pypaf-0.3.0}/LICENSE.txt +0 -0
  12. {pypaf-0.2.0 → pypaf-0.3.0}/pyproject.toml +0 -0
  13. {pypaf-0.2.0 → pypaf-0.3.0}/setup.cfg +0 -0
  14. {pypaf-0.2.0 → pypaf-0.3.0}/src/PyPaf.egg-info/dependency_links.txt +0 -0
  15. {pypaf-0.2.0 → pypaf-0.3.0}/src/PyPaf.egg-info/top_level.txt +0 -0
  16. {pypaf-0.2.0 → pypaf-0.3.0}/src/paf/__init__.py +0 -0
  17. {pypaf-0.2.0 → pypaf-0.3.0}/src/paf/attribute.py +0 -0
  18. {pypaf-0.2.0 → pypaf-0.3.0}/src/paf/lineable.py +0 -0
  19. {pypaf-0.2.0 → pypaf-0.3.0}/src/paf/paf.py +0 -0
  20. {pypaf-0.2.0 → pypaf-0.3.0}/src/paf/premises/__init__.py +0 -0
  21. {pypaf-0.2.0 → pypaf-0.3.0}/src/paf/premises/common.py +0 -0
  22. {pypaf-0.2.0 → pypaf-0.3.0}/src/paf/premises/rule000.py +0 -0
  23. {pypaf-0.2.0 → pypaf-0.3.0}/src/paf/premises/rule001.py +0 -0
  24. {pypaf-0.2.0 → pypaf-0.3.0}/src/paf/premises/rule011.py +0 -0
  25. {pypaf-0.2.0 → pypaf-0.3.0}/src/paf/premises/rule101.py +0 -0
  26. {pypaf-0.2.0 → pypaf-0.3.0}/src/paf/premises/rule110.py +0 -0
  27. {pypaf-0.2.0 → pypaf-0.3.0}/src/paf/premises_extender.py +0 -0
  28. {pypaf-0.2.0 → pypaf-0.3.0}/src/paf/thoroughfare_locality.py +0 -0
  29. {pypaf-0.2.0 → pypaf-0.3.0}/tests/test_exception_i.py +0 -0
  30. {pypaf-0.2.0 → pypaf-0.3.0}/tests/test_exception_ii.py +0 -0
  31. {pypaf-0.2.0 → pypaf-0.3.0}/tests/test_exception_iii.py +0 -0
  32. {pypaf-0.2.0 → pypaf-0.3.0}/tests/test_mainfile.py +0 -0
  33. {pypaf-0.2.0 → pypaf-0.3.0}/tests/test_po_box.py +0 -0
  34. {pypaf-0.2.0 → pypaf-0.3.0}/tests/test_rule_1.py +0 -0
  35. {pypaf-0.2.0 → pypaf-0.3.0}/tests/test_rule_2.py +0 -0
  36. {pypaf-0.2.0 → pypaf-0.3.0}/tests/test_rule_3.py +0 -0
  37. {pypaf-0.2.0 → pypaf-0.3.0}/tests/test_rule_4.py +0 -0
  38. {pypaf-0.2.0 → pypaf-0.3.0}/tests/test_rule_5.py +0 -0
  39. {pypaf-0.2.0 → pypaf-0.3.0}/tests/test_rule_6.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: PyPaf
3
- Version: 0.2.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,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 5.0](http://www.royalmail.com/sites/default/files/docs/pdf/programmers_guide_edition_7_v5.pdf)
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
 
@@ -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 5.0](http://www.royalmail.com/sites/default/files/docs/pdf/programmers_guide_edition_7_v5.pdf)
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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: PyPaf
3
- Version: 0.2.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,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 5.0](http://www.royalmail.com/sites/default/files/docs/pdf/programmers_guide_edition_7_v5.pdf)
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
 
@@ -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
@@ -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 True
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'], ', ')
@@ -0,0 +1,3 @@
1
+ """Version"""
2
+
3
+ __version__ = '0.3.0'
@@ -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()
@@ -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
 
@@ -1,3 +0,0 @@
1
- """Version"""
2
-
3
- __version__ = '0.2.0'
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