From e5f0d22910b3dfef503c6c3ef24c037fccef5f0f Mon Sep 17 00:00:00 2001 From: Fabio Caccamo Date: Mon, 6 Nov 2017 11:42:08 +0100 Subject: [PATCH] Removed omocodes argument from encode method --- README.md | 13 ------------- README.rst | 15 --------------- codicefiscale/codicefiscale.py | 8 ++------ tests/tests.py | 9 +-------- 4 files changed, 3 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index e377355..15033eb 100644 --- a/README.md +++ b/README.md @@ -30,19 +30,6 @@ codicefiscale.encode(surname='Caccamo', name='Fabio', sex='M', birthdate='03/04/ # 'CCCFBA85D03L219P' ``` -```python -codicefiscale.encode(surname='Caccamo', name='Fabio', sex='M', birthdate='03/04/1985', birthplace='Torino', omocodes=True) - -# [ -# 'CCCFBA85D03L219P', -# 'CCCFBA85D03L21VE', -# 'CCCFBA85D03L2MVP', -# 'CCCFBA85D03LNMVE', -# 'CCCFBA85D0PLNMVA', -# 'CCCFBA85DLPLNMVL', -# 'CCCFBA8RDLPLNMVX', -# 'CCCFBAURDLPLNMVU' -# ] ``` #### Decode ```python diff --git a/README.rst b/README.rst index 980bfa3..f7f1396 100644 --- a/README.rst +++ b/README.rst @@ -38,21 +38,6 @@ Encode # 'CCCFBA85D03L219P' -.. code:: python - - codicefiscale.encode(surname='Caccamo', name='Fabio', sex='M', birthdate='03/04/1985', birthplace='Torino', omocodes=True) - - # [ - # 'CCCFBA85D03L219P', - # 'CCCFBA85D03L21VE', - # 'CCCFBA85D03L2MVP', - # 'CCCFBA85D03LNMVE', - # 'CCCFBA85D0PLNMVA', - # 'CCCFBA85DLPLNMVL', - # 'CCCFBA8RDLPLNMVX', - # 'CCCFBAURDLPLNMVU' - # ] - Decode ^^^^^^ diff --git a/codicefiscale/codicefiscale.py b/codicefiscale/codicefiscale.py index 353ccdc..6a8c594 100644 --- a/codicefiscale/codicefiscale.py +++ b/codicefiscale/codicefiscale.py @@ -213,7 +213,7 @@ def encode_cin(code): return cin_code -def encode(surname, name, sex, birthdate, birthplace, omocodes=False): +def encode(surname, name, sex, birthdate, birthplace): code = '' code += encode_surname(surname) @@ -224,11 +224,7 @@ def encode(surname, name, sex, birthdate, birthplace, omocodes=False): # raise ValueError if code is not valid data = decode(code) - - if omocodes: - return data['omocodes'] - else: - return data['code'] + return data['code'] def decode_raw(code): diff --git a/tests/tests.py b/tests/tests.py index 308c5a3..512f167 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -311,13 +311,6 @@ def test_encode(self): code = codicefiscale.encode(**obj['input']) self.assertEqual(code, obj['result']) - for obj in data: - obj['input']['omocodes'] = True - # with self.subTest(obj=obj): - codes = codicefiscale.encode(**obj['input']) - self.assertEqual(8, len(codes)) - self.assertEqual(codes[0], obj['result']) - def test_decode(self): data = [ @@ -364,7 +357,7 @@ def test_decode(self): result = obj['result'] obj_decoded = codicefiscale.decode(obj['input']) - # print(obj_decoded) + print(obj_decoded) sex = obj_decoded.get('sex') self.assertFalse(sex is None)