PyPaf 0.3.0__tar.gz → 0.5.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 (42) hide show
  1. {pypaf-0.3.0/src/PyPaf.egg-info → pypaf-0.5.0}/PKG-INFO +8 -8
  2. {pypaf-0.3.0 → pypaf-0.5.0}/README.md +7 -7
  3. {pypaf-0.3.0 → pypaf-0.5.0/src/PyPaf.egg-info}/PKG-INFO +8 -8
  4. {pypaf-0.3.0 → pypaf-0.5.0}/src/PyPaf.egg-info/SOURCES.txt +3 -1
  5. pypaf-0.5.0/src/paf/__init__.py +6 -0
  6. pypaf-0.3.0/src/paf/paf.py → pypaf-0.5.0/src/paf/address.py +15 -13
  7. pypaf-0.5.0/src/paf/immutable.py +12 -0
  8. {pypaf-0.3.0 → pypaf-0.5.0}/src/paf/premises/rule010.py +3 -3
  9. {pypaf-0.3.0 → pypaf-0.5.0}/src/paf/premises_extender.py +3 -1
  10. pypaf-0.5.0/src/paf/version.py +3 -0
  11. {pypaf-0.3.0 → pypaf-0.5.0}/tests/test_exception_i.py +7 -7
  12. {pypaf-0.3.0 → pypaf-0.5.0}/tests/test_exception_ii.py +7 -7
  13. {pypaf-0.3.0 → pypaf-0.5.0}/tests/test_exception_iii.py +7 -7
  14. {pypaf-0.3.0 → pypaf-0.5.0}/tests/test_exception_iv.py +17 -17
  15. pypaf-0.5.0/tests/test_immutability.py +38 -0
  16. {pypaf-0.3.0 → pypaf-0.5.0}/tests/test_mainfile.py +7 -7
  17. {pypaf-0.3.0 → pypaf-0.5.0}/tests/test_po_box.py +7 -7
  18. {pypaf-0.3.0 → pypaf-0.5.0}/tests/test_rule_1.py +7 -7
  19. {pypaf-0.3.0 → pypaf-0.5.0}/tests/test_rule_2.py +7 -7
  20. {pypaf-0.3.0 → pypaf-0.5.0}/tests/test_rule_3.py +22 -22
  21. {pypaf-0.3.0 → pypaf-0.5.0}/tests/test_rule_4.py +7 -7
  22. {pypaf-0.3.0 → pypaf-0.5.0}/tests/test_rule_5.py +16 -12
  23. {pypaf-0.3.0 → pypaf-0.5.0}/tests/test_rule_6.py +21 -17
  24. {pypaf-0.3.0 → pypaf-0.5.0}/tests/test_rule_7.py +25 -17
  25. pypaf-0.3.0/src/paf/__init__.py +0 -6
  26. pypaf-0.3.0/src/paf/version.py +0 -3
  27. {pypaf-0.3.0 → pypaf-0.5.0}/LICENSE.txt +0 -0
  28. {pypaf-0.3.0 → pypaf-0.5.0}/pyproject.toml +0 -0
  29. {pypaf-0.3.0 → pypaf-0.5.0}/setup.cfg +0 -0
  30. {pypaf-0.3.0 → pypaf-0.5.0}/src/PyPaf.egg-info/dependency_links.txt +0 -0
  31. {pypaf-0.3.0 → pypaf-0.5.0}/src/PyPaf.egg-info/top_level.txt +0 -0
  32. {pypaf-0.3.0 → pypaf-0.5.0}/src/paf/attribute.py +0 -0
  33. {pypaf-0.3.0 → pypaf-0.5.0}/src/paf/lineable.py +0 -0
  34. {pypaf-0.3.0 → pypaf-0.5.0}/src/paf/premises/__init__.py +0 -0
  35. {pypaf-0.3.0 → pypaf-0.5.0}/src/paf/premises/common.py +0 -0
  36. {pypaf-0.3.0 → pypaf-0.5.0}/src/paf/premises/rule000.py +0 -0
  37. {pypaf-0.3.0 → pypaf-0.5.0}/src/paf/premises/rule001.py +0 -0
  38. {pypaf-0.3.0 → pypaf-0.5.0}/src/paf/premises/rule011.py +0 -0
  39. {pypaf-0.3.0 → pypaf-0.5.0}/src/paf/premises/rule101.py +0 -0
  40. {pypaf-0.3.0 → pypaf-0.5.0}/src/paf/premises/rule110.py +0 -0
  41. {pypaf-0.3.0 → pypaf-0.5.0}/src/paf/premises/rule111.py +0 -0
  42. {pypaf-0.3.0 → pypaf-0.5.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.0
3
+ Version: 0.5.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
@@ -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
- from paf import Paf
32
- paf = Paf({
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
- paf.list() # or list(paf)
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
- from paf import Paf
49
- paf = Paf({
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
- paf.str() # or str(paf)
57
+ address.str() # or str(address)
58
58
 
59
59
  '1-2 NURSERY LANE, PENN, HIGH WYCOMBE. HP10 8LS'
60
60
  ```
@@ -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
- from paf import Paf
17
- paf = Paf({
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
- paf.list() # or list(paf)
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
- from paf import Paf
34
- paf = Paf({
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
- paf.str() # or str(paf)
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.0
3
+ Version: 0.5.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
@@ -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
- from paf import Paf
32
- paf = Paf({
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
- paf.list() # or list(paf)
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
- from paf import Paf
49
- paf = Paf({
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
- paf.str() # or str(paf)
57
+ address.str() # or str(address)
58
58
 
59
59
  '1-2 NURSERY LANE, PENN, HIGH WYCOMBE. HP10 8LS'
60
60
  ```
@@ -6,9 +6,10 @@ 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
11
+ src/paf/immutable.py
10
12
  src/paf/lineable.py
11
- src/paf/paf.py
12
13
  src/paf/premises_extender.py
13
14
  src/paf/thoroughfare_locality.py
14
15
  src/paf/version.py
@@ -25,6 +26,7 @@ tests/test_exception_i.py
25
26
  tests/test_exception_ii.py
26
27
  tests/test_exception_iii.py
27
28
  tests/test_exception_iv.py
29
+ tests/test_immutability.py
28
30
  tests/test_mainfile.py
29
31
  tests/test_po_box.py
30
32
  tests/test_rule_1.py
@@ -0,0 +1,6 @@
1
+ """__init__ file"""
2
+
3
+ from .address import Address
4
+ from .version import __version__
5
+
6
+ __all__ = ["Address", "__version__"]
@@ -1,41 +1,43 @@
1
- """Paf"""
1
+ """PAF Address"""
2
2
 
3
+ # Tried using dataclasses.dataclass(frozen=True) decorator for immutablity but did not work"""
4
+ from .immutable import ImmutableMixin
3
5
  from .lineable import LineableMixin
4
6
 
5
- class Paf(LineableMixin):
6
- """Main Paf class"""
7
+ class Address(ImmutableMixin, LineableMixin):
8
+ """Main PAF Address class"""
7
9
 
8
10
  def __init__(self, args):
9
- """Initialise Paf address elements"""
10
- for key in self.__class__.attrs:
11
- setattr(self, key, '')
11
+ """Initialise Address elements"""
12
+ for key in self.__class__.attrs: # pylint: disable=not-an-iterable
13
+ object.__setattr__(self, key, '')
12
14
  for key, val in args.items():
13
15
  if hasattr(self, key):
14
- setattr(self, key, val)
16
+ object.__setattr__(self, key, val)
15
17
  self.extend_premises()
16
18
 
17
19
  def __repr__(self):
18
- """Return full representation of Paf"""
19
- args = {k: getattr(self, k) for k in self.__class__.attrs if getattr(self, k, None)}
20
+ """Return full representation of an Address"""
21
+ args = {k: getattr(self, k) for k in self.__class__.attrs if getattr(self, k, None)} # pylint: disable=not-an-iterable
20
22
  return self.__class__.__name__ + '(' + str(args) + ')'
21
23
 
22
24
  def __str__(self):
23
- """Return Paf as string representation"""
25
+ """Return Address as string representation"""
24
26
  line = ', '.join(self.lines)
25
27
  if self.is_empty('postcode'):
26
28
  return line
27
29
  return '. '.join([line] + [getattr(self, 'postcode')])
28
30
 
29
31
  def __iter__(self):
30
- """Return Paf as iterable"""
32
+ """Return Address as iterable"""
31
33
  yield from self.lines.__iter__()
32
34
  if not self.is_empty('postcode'):
33
35
  yield from [getattr(self, 'postcode')].__iter__()
34
36
 
35
37
  def str(self):
36
- """Return Paf as string"""
38
+ """Return Address as string"""
37
39
  return str(self)
38
40
 
39
41
  def list(self):
40
- """Return Paf as list of strings"""
42
+ """Return Address as list of strings"""
41
43
  return list(self)
@@ -0,0 +1,12 @@
1
+ """Immutable Mixin"""
2
+
3
+ from dataclasses import FrozenInstanceError
4
+
5
+ class ImmutableMixin():
6
+ """Prevent manipulation of object attributes"""
7
+
8
+ def __setattr__(self, *_):
9
+ raise FrozenInstanceError
10
+
11
+ def __delattr__(self, *_):
12
+ raise FrozenInstanceError
@@ -26,12 +26,12 @@ class Rule010(Common):
26
26
  return(
27
27
  self.is_exception('building_name_last_word') and
28
28
  not re.match(r'^\d+$', self.building_name_last_word) and
29
- not self.is_non_split_building_name
29
+ not self.is_known_building_type
30
30
  )
31
31
 
32
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"""
33
+ def is_known_building_type(self):
34
+ """Returns if building name starts with a known building type"""
35
35
  return self.building_name_but_last_word in [
36
36
  "BACK OF", "BLOCK", "BLOCKS", "BUILDING", "MAISONETTE", "MAISONETTES", "REAR OF",
37
37
  "SHOP", "SHOPS", "STALL", "STALLS", "SUITE", "SUITES", "UNIT", "UNITS"
@@ -22,4 +22,6 @@ class PremisesExtenderMixin(AttributeMixin):
22
22
  def extend_premises(self):
23
23
  """Dynamically extends instance with appropriate premises rule"""
24
24
  base_cls = self.__class__
25
- self.__class__ = type(base_cls.__name__, (base_cls, self.premises_rule), {})
25
+ object.__setattr__(
26
+ self, '__class__', type(base_cls.__name__, (base_cls, self.premises_rule), {})
27
+ )
@@ -0,0 +1,3 @@
1
+ """Version"""
2
+
3
+ __version__ = '0.5.0'
@@ -1,14 +1,14 @@
1
- """Test Paf Exception I formatting"""
1
+ """Test Address Exception I formatting"""
2
2
 
3
3
  import unittest
4
- from paf import Paf
4
+ import paf
5
5
 
6
6
  class TestExceptionI(unittest.TestCase):
7
- """Test Paf Exception I"""
7
+ """Test Address Exception I"""
8
8
 
9
9
  def setUp(self):
10
- """Set up Paf instance"""
11
- self.paf = Paf({
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.paf.list(), address, "Incorrect Exception I list format")
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.paf.str(), address, "Incorrect Exception I string format")
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 Paf Exception II formatting"""
1
+ """Test Address Exception II formatting"""
2
2
 
3
3
  import unittest
4
- from paf import Paf
4
+ import paf
5
5
 
6
6
  class TestExceptionII(unittest.TestCase):
7
- """Test Paf Exception II"""
7
+ """Test Address Exception II"""
8
8
 
9
9
  def setUp(self):
10
- """Set up Paf instance"""
11
- self.paf = Paf({
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.paf.list(), address, "Incorrect Exception II list format")
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.paf.str(), address, "Incorrect Exception II string format")
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 Paf Exception III formatting"""
1
+ """Test Address Exception III formatting"""
2
2
 
3
3
  import unittest
4
- from paf import Paf
4
+ import paf
5
5
 
6
6
  class TestExceptionIII(unittest.TestCase):
7
- """Test Paf Exception III"""
7
+ """Test Address Exception III"""
8
8
 
9
9
  def setUp(self):
10
- """Set up Paf instance"""
11
- self.paf = Paf({
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.paf.list(), address, "Incorrect Exception III list format")
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.paf.str(), address, "Incorrect Exception III string format")
27
+ self.assertEqual(self.address.str(), address, "Incorrect Exception III string format")
28
28
 
29
29
  if __name__ == '__main__':
30
30
  unittest.main()
@@ -1,14 +1,14 @@
1
- """Test Paf Exception IV formatting"""
1
+ """Test Address Exception IV formatting"""
2
2
 
3
3
  import unittest
4
- from paf import Paf
4
+ import paf
5
5
 
6
6
  class TestExceptionIVUnit(unittest.TestCase):
7
- """Test Paf Exception IV Unit"""
7
+ """Test Address Exception IV Unit"""
8
8
 
9
9
  def setUp(self):
10
- """Set up Paf instance"""
11
- self.paf = Paf({
10
+ """Set up Address instance"""
11
+ self.address = paf.Address({
12
12
  'organisation_name': "THE TAMBOURINE WAREHOUSE",
13
13
  'building_name': "UNIT 1-3",
14
14
  'dependent_thoroughfare_name': "INDUSTRIAL",
@@ -29,19 +29,19 @@ class TestExceptionIVUnit(unittest.TestCase):
29
29
  "LONDON",
30
30
  "E6 7HS"
31
31
  ]
32
- self.assertEqual(self.paf.list(), address, "Incorrect Exception IV Unit list format")
32
+ self.assertEqual(self.address.list(), address, "Incorrect Exception IV Unit list format")
33
33
 
34
34
  def test_string(self):
35
35
  """Test conversion to a string"""
36
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")
37
+ self.assertEqual(self.address.str(), address, "Incorrect Exception IV Unit string format")
38
38
 
39
39
  class TestExceptionIVStall(unittest.TestCase):
40
- """Test Paf Exception IV Stall"""
40
+ """Test Address Exception IV Stall"""
41
41
 
42
42
  def setUp(self):
43
- """Set up Paf instance"""
44
- self.paf = Paf({
43
+ """Set up Address instance"""
44
+ self.address = paf.Address({
45
45
  'organisation_name': "QUIRKY CANDLES LTD",
46
46
  'building_name': "STALL 4",
47
47
  'thoroughfare_name': "MARKET",
@@ -59,19 +59,19 @@ class TestExceptionIVStall(unittest.TestCase):
59
59
  "LIVERPOOL",
60
60
  "L8 1LH"
61
61
  ]
62
- self.assertEqual(self.paf.list(), address, "Incorrect Exception IV Stall list format")
62
+ self.assertEqual(self.address.list(), address, "Incorrect Exception IV Stall list format")
63
63
 
64
64
  def test_string(self):
65
65
  """Test conversion to a string"""
66
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")
67
+ self.assertEqual(self.address.str(), address, "Incorrect Exception IV Stall string format")
68
68
 
69
69
  class TestExceptionIVRearOf(unittest.TestCase):
70
- """Test Paf Exception IV Rear Of"""
70
+ """Test Address Exception IV Rear Of"""
71
71
 
72
72
  def setUp(self):
73
- """Set up Paf instance"""
74
- self.paf = Paf({
73
+ """Set up Address instance"""
74
+ self.address = paf.Address({
75
75
  'organisation_name': "FIONA'S FLOWERS",
76
76
  'building_name': "REAR OF 5A",
77
77
  'thoroughfare_name': "HIGH",
@@ -89,12 +89,12 @@ class TestExceptionIVRearOf(unittest.TestCase):
89
89
  "GATESHEAD",
90
90
  "NE8 1BH"
91
91
  ]
92
- self.assertEqual(self.paf.list(), address, "Incorrect Exception IV Rear Of list format")
92
+ self.assertEqual(self.address.list(), address, "Incorrect Exception IV RearOf list format")
93
93
 
94
94
  def test_string(self):
95
95
  """Test conversion to a string"""
96
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")
97
+ self.assertEqual(self.address.str(), address, "Incorrect Exception IV RearOf string format")
98
98
 
99
99
  if __name__ == '__main__':
100
100
  unittest.main()
@@ -0,0 +1,38 @@
1
+ """Test Immutability"""
2
+
3
+ import unittest
4
+ from dataclasses import FrozenInstanceError
5
+ import paf
6
+
7
+ class TestImmutability(unittest.TestCase):
8
+ """Test Immutable"""
9
+
10
+ def setUp(self):
11
+ """Set up Address instance"""
12
+ self.address = paf.Address({
13
+ 'building_number': "16",
14
+ 'thoroughfare_name': "VIXEN",
15
+ 'thoroughfare_descriptor': "ROAD",
16
+ 'post_town': "BRADOCK",
17
+ 'postcode': "KT6 5BT"
18
+ })
19
+
20
+ def test_assignment(self):
21
+ """Test setting attribute by direct assignment"""
22
+ with self.assertRaises(FrozenInstanceError):
23
+ self.address.building_name = "THE HOUSE"
24
+
25
+ def test_setattr(self):
26
+ """Test setting new attribute"""
27
+ self.assertRaises(FrozenInstanceError, setattr, self.address, 'building_name', "THE HOUSE")
28
+
29
+ def test_resetattr(self):
30
+ """Test re-setting existing attribute"""
31
+ self.assertRaises(FrozenInstanceError, setattr, self.address, 'building_number', "20")
32
+
33
+ def test_delattr(self):
34
+ """Test deleting attribute"""
35
+ self.assertRaises(FrozenInstanceError, delattr, self.address, 'post_town')
36
+
37
+ if __name__ == '__main__':
38
+ unittest.main()
@@ -1,14 +1,14 @@
1
- """Test Paf Mainfile formatting"""
1
+ """Test Address Mainfile formatting"""
2
2
 
3
3
  import unittest
4
- from paf import Paf
4
+ import paf
5
5
 
6
6
  class TestMainfile(unittest.TestCase):
7
- """Test Paf Mainfile"""
7
+ """Test Address Mainfile"""
8
8
 
9
9
  def setUp(self):
10
- """Set up Paf instance"""
11
- self.paf = Paf({
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.paf.list(), address, "Incorrect Mainfile list format")
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.paf.str(), address, "Incorrect Mainfile string format")
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 Paf PO Box formatting"""
1
+ """Test Address PO Box formatting"""
2
2
 
3
3
  import unittest
4
- from paf import Paf
4
+ import paf
5
5
 
6
6
  class TestPoBox(unittest.TestCase):
7
- """Test Paf PO Box"""
7
+ """Test Address PO Box"""
8
8
 
9
9
  def setUp(self):
10
- """Set up Paf instance"""
11
- self.paf = Paf({
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.paf.list(), address, "Incorrect PO Box list format")
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.paf.str(), address, "Incorrect PO Box string format")
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 Paf Rule 1 formatting"""
1
+ """Test Address Rule 1 formatting"""
2
2
 
3
3
  import unittest
4
- from paf import Paf
4
+ import paf
5
5
 
6
6
  class TestRule1(unittest.TestCase):
7
- """Test Paf Rule 1"""
7
+ """Test Address Rule 1"""
8
8
 
9
9
  def setUp(self):
10
- """Set up Paf instance"""
11
- self.paf = Paf({
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.paf.list(), address, "Incorrect Rule 1 list format")
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.paf.str(), address, "Incorrect Rule 1 string format")
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 Paf Rule 2 formatting"""
1
+ """Test Address Rule 2 formatting"""
2
2
 
3
3
  import unittest
4
- from paf import Paf
4
+ import paf
5
5
 
6
6
  class TestRule2(unittest.TestCase):
7
- """Test Paf Rule 2"""
7
+ """Test Address Rule 2"""
8
8
 
9
9
  def setUp(self):
10
- """Set up Paf instance"""
11
- self.paf = Paf({
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.paf.list(), address, "Incorrect Rule 2 list format")
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.paf.str(), address, "Incorrect Rule 2 string format")
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 Paf Rule 3 formatting"""
1
+ """Test Address Rule 3 formatting"""
2
2
 
3
3
  import unittest
4
- from paf import Paf
4
+ import paf
5
5
 
6
6
  class TestRule3WithBuildingName(unittest.TestCase):
7
- """Test Paf Rule 3 with Building Name Exception"""
7
+ """Test Address Rule 3 with Building Name Exception"""
8
8
 
9
9
  def setUp(self):
10
- """Set up Paf instance"""
11
- self.paf = Paf({
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.paf.list(), address, "Incorrect Rule 3 with building list format")
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.paf.str(), address, "Incorrect Rule 3 with building string format")
29
+ self.assertEqual(self.address.str(), address, "Incorrect Rule 3 w/ building string format")
30
30
 
31
31
  class TestRule3WithoutBuildingName(unittest.TestCase):
32
- """Test Paf Rule 3 without Building Name Exception"""
32
+ """Test Address Rule 3 without Building Name Exception"""
33
33
 
34
34
  def setUp(self):
35
- """Set up Paf instance"""
36
- self.paf = Paf({
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.paf.list(), address, "Incorrect Rule 3 without building list format")
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.paf.str(), address, "Incorrect Rule 3 without building string format")
52
+ self.assertEqual(self.address.str(), address, "Incorrect Rule 3 w/ building string format")
53
53
 
54
54
  class TestRule3WithSplit(unittest.TestCase):
55
- """Test Paf Rule 3 with Split Exception"""
55
+ """Test Address Rule 3 with Split Exception"""
56
56
 
57
57
  def setUp(self):
58
- """Set up Paf instance"""
59
- self.paf = Paf({
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.paf.list(), address, "Incorrect Rule 3 with split list format")
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.paf.str(), address, "Incorrect Rule 3 with split string format")
82
+ self.assertEqual(self.address.str(), address, "Incorrect Rule 3 with split string format")
83
83
 
84
84
  class TestRule3WithoutSplit(unittest.TestCase):
85
- """Test Paf Rule 3 without Split Exception"""
85
+ """Test Address Rule 3 without Split Exception"""
86
86
 
87
87
  def setUp(self):
88
- """Set up Paf instance"""
89
- self.paf = Paf({
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.paf.list(), address, "Incorrect Rule 3 without split list format")
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.paf.str(), address, "Incorrect Rule 3 without split string format")
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 Paf Rule 4 formatting"""
1
+ """Test Address Rule 4 formatting"""
2
2
 
3
3
  import unittest
4
- from paf import Paf
4
+ import paf
5
5
 
6
6
  class TestRule4(unittest.TestCase):
7
- """Test Paf Rule 4"""
7
+ """Test Address Rule 4"""
8
8
 
9
9
  def setUp(self):
10
- """Set up Paf instance"""
11
- self.paf = Paf({
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.paf.list(), address, "Incorrect Rule 4 list format")
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.paf.str(), address, "Incorrect Rule 4 string format")
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 Paf Rule 5 formatting"""
1
+ """Test Address Rule 5 formatting"""
2
2
 
3
3
  import unittest
4
- from paf import Paf
4
+ import paf
5
5
 
6
6
  class TestRule5(unittest.TestCase):
7
- """Test Paf Rule 5"""
7
+ """Test Address Rule 5"""
8
8
 
9
9
  def setUp(self):
10
- """Set up Paf instance"""
11
- self.paf = Paf({
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.paf.list(), address, "Incorrect Rule 5 list format")
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.paf.str(), address, "Incorrect Rule 5 string format")
28
+ self.assertEqual(self.address.str(), address, "Incorrect Rule 5 string format")
29
29
 
30
30
  class TestRule5WithConcatenation(unittest.TestCase):
31
- """Test Paf Rule 5 with Concatenation"""
31
+ """Test Address Rule 5 with Concatenation"""
32
32
 
33
33
  def setUp(self):
34
- """Set up Paf instance"""
35
- self.paf = Paf({
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(self.paf.list(), address, "Incorrect Rule 5 with concatenate list format")
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(self.paf.str(), address, "Incorrect Rule 5 with concatenate string format")
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 Paf Rule 6 formatting"""
1
+ """Test Address Rule 6 formatting"""
2
2
 
3
3
  import unittest
4
- from paf import Paf
4
+ import paf
5
5
 
6
6
  class TestRule6WithSubBuildingName(unittest.TestCase):
7
- """Test Paf Rule 6 with Sub-Building Name Exception"""
7
+ """Test Address Rule 6 with Sub-Building Name Exception"""
8
8
 
9
9
  def setUp(self):
10
- """Set up Paf instance"""
11
- self.paf = Paf({
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(self.paf.list(), address, "Incorrect Rule 6 with sub-building list format")
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(self.paf.str(), address, "Incorrect Rule 6 w/ sub-building string format")
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 Paf Rule 6 with Building Name Exception"""
35
+ """Test Address Rule 6 with Building Name Exception"""
32
36
 
33
37
  def setUp(self):
34
- """Set up Paf instance"""
35
- self.paf = Paf({
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.paf.list(), address, "Incorrect Rule 6 with building list format")
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.paf.str(), address, "Incorrect Rule 6 with building string format")
56
+ self.assertEqual(self.address.str(), address, "Incorrect Rule 6 w/ building string format")
53
57
 
54
58
  class TestRule6(unittest.TestCase):
55
- """Test Paf Rule 6 without Exception"""
59
+ """Test Address Rule 6 without Exception"""
56
60
 
57
61
  def setUp(self):
58
- """Set up Paf instance"""
59
- self.paf = Paf({
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.paf.list(), address, "Incorrect Rule 6 list format")
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.paf.str(), address, "Incorrect Rule 6 string format")
80
+ self.assertEqual(self.address.str(), address, "Incorrect Rule 6 string format")
77
81
 
78
82
  if __name__ == '__main__':
79
83
  unittest.main()
@@ -1,14 +1,14 @@
1
- """Test Paf Rule 7 formatting"""
1
+ """Test Address Rule 7 formatting"""
2
2
 
3
3
  import unittest
4
- from paf import Paf
4
+ import paf
5
5
 
6
6
  class TestRule7WithZeroBuildingNumber(unittest.TestCase):
7
- """Test Paf Rule 7 with a 0 Building Number"""
7
+ """Test Address Rule 7 with a 0 Building Number"""
8
8
 
9
9
  def setUp(self):
10
- """Set up Paf instance"""
11
- self.paf = Paf({
10
+ """Set up Address instance"""
11
+ self.address = paf.Address({
12
12
  'sub_building_name': "FLAT 1",
13
13
  'building_name': "HOLLY HOUSE",
14
14
  'building_number': "0",
@@ -22,19 +22,23 @@ class TestRule7WithZeroBuildingNumber(unittest.TestCase):
22
22
  def test_list(self):
23
23
  """Test conversion to an list"""
24
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")
25
+ self.assertEqual(
26
+ self.address.list(), address, "Incorrect Rule 7 with 0 building number format"
27
+ )
26
28
 
27
29
  def test_string(self):
28
30
  """Test conversion to a string"""
29
31
  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")
32
+ self.assertEqual(
33
+ self.address.str(), address, "Incorrect Rule 7 with 0 building number format"
34
+ )
31
35
 
32
36
  class TestRule7WithSubBuildingName(unittest.TestCase):
33
- """Test Paf Rule 7 with Sub-Building Name Exception"""
37
+ """Test Address Rule 7 with Sub-Building Name Exception"""
34
38
 
35
39
  def setUp(self):
36
- """Set up Paf instance"""
37
- self.paf = Paf({
40
+ """Set up Address instance"""
41
+ self.address = paf.Address({
38
42
  'sub_building_name': "2B",
39
43
  'building_name': "THE TOWER",
40
44
  'building_number': "27",
@@ -47,19 +51,23 @@ class TestRule7WithSubBuildingName(unittest.TestCase):
47
51
  def test_list(self):
48
52
  """Test conversion to an list"""
49
53
  address = ["2B THE TOWER", "27 JOHN STREET", "WINCHESTER", "SO23 9AP"]
50
- self.assertEqual(self.paf.list(), address, "Incorrect Rule 7 with sub-building list format")
54
+ self.assertEqual(
55
+ self.address.list(), address, "Incorrect Rule 7 with sub-building list format"
56
+ )
51
57
 
52
58
  def test_string(self):
53
59
  """Test conversion to a string"""
54
60
  address = "2B THE TOWER, 27 JOHN STREET, WINCHESTER. SO23 9AP"
55
- self.assertEqual(self.paf.str(), address, "Incorrect Rule 7 w/ sub-building string format")
61
+ self.assertEqual(
62
+ self.address.str(), address, "Incorrect Rule 7 with sub-building string format"
63
+ )
56
64
 
57
65
  class TestRule7(unittest.TestCase):
58
- """Test Paf Rule 7 without Exception"""
66
+ """Test Address Rule 7 without Exception"""
59
67
 
60
68
  def setUp(self):
61
- """Set up Paf instance"""
62
- self.paf = Paf({
69
+ """Set up Address instance"""
70
+ self.address = paf.Address({
63
71
  'sub_building_name': "BASEMENT FLAT",
64
72
  'building_name': "VICTORIA HOUSE",
65
73
  'building_number': "15",
@@ -72,12 +80,12 @@ class TestRule7(unittest.TestCase):
72
80
  def test_list(self):
73
81
  """Test conversion to an list"""
74
82
  address = ["BASEMENT FLAT", "VICTORIA HOUSE", "15 THE STREET", "CORYTON", "BP23 6AA"]
75
- self.assertEqual(self.paf.list(), address, "Incorrect Rule 7 list format")
83
+ self.assertEqual(self.address.list(), address, "Incorrect Rule 7 list format")
76
84
 
77
85
  def test_string(self):
78
86
  """Test conversion to a string"""
79
87
  address = "BASEMENT FLAT, VICTORIA HOUSE, 15 THE STREET, CORYTON. BP23 6AA"
80
- self.assertEqual(self.paf.str(), address, "Incorrect Rule 7 string format")
88
+ self.assertEqual(self.address.str(), address, "Incorrect Rule 7 string format")
81
89
 
82
90
  if __name__ == '__main__':
83
91
  unittest.main()
@@ -1,6 +0,0 @@
1
- """__init__ file"""
2
-
3
- from .paf import Paf
4
- from .version import __version__
5
-
6
- __all__ = ["Paf", "__version__"]
@@ -1,3 +0,0 @@
1
- """Version"""
2
-
3
- __version__ = '0.3.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