lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.13-37-gfeca1fe

[Date Prev][Date Next] [Thread Prev][Thread Next]

python-stdnum branch master updated. 1.13-37-gfeca1fe



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-stdnum".

The branch, master has been updated
       via  feca1fe4e717ff69d6471119082f4435e16adcae (commit)
      from  dab926cfd86b6dc85f688de59b398ca98320b577 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://arthurdejong.org/git/python-stdnum/commit/?id=feca1fe4e717ff69d6471119082f4435e16adcae

commit feca1fe4e717ff69d6471119082f4435e16adcae
Author: evaldez89 <evaldez89@gmail.com>
Date:   Fri Jul 31 21:48:03 2020 -0400

    Scape new line character
    
    Closes https://github.com/arthurdejong/python-stdnum/pull/233
    Closes https://github.com/arthurdejong/python-stdnum/issues/232

diff --git a/stdnum/do/rnc.py b/stdnum/do/rnc.py
index 6bac651..ddc6c3b 100644
--- a/stdnum/do/rnc.py
+++ b/stdnum/do/rnc.py
@@ -112,7 +112,7 @@ def _convert_result(result):  # pragma: no cover
     }
     return dict(
         (translation.get(key, key), value)
-        for key, value in json.loads(result.replace('\t', '\\t')).items())
+        for key, value in json.loads(result.replace('\n', '\\n').replace('\t', 
'\\t')).items())
 
 
 def check_dgii(number, timeout=30):  # pragma: no cover
diff --git a/tests/test_do_rnc.py b/tests/test_do_rnc.py
index fd2336a..9ea06c9 100644
--- a/tests/test_do_rnc.py
+++ b/tests/test_do_rnc.py
@@ -53,6 +53,10 @@ class TestDGII(unittest.TestCase):
         # Test a number on the whitelist
         result = rnc.check_dgii('501658167')
         self.assertEqual(result['rnc'], '501658167')
+        # Test the output unescaping (\t and \n) of the result so JSON
+        # deserialisation works
+        result = rnc.check_dgii('132070801')
+        self.assertEqual(result['rnc'], '132070801')
 
     def test_search_dgii(self):
         """Test stdnum.do.rnc.search_dgii()"""

-----------------------------------------------------------------------

Summary of changes:
 stdnum/do/rnc.py     | 2 +-
 tests/test_do_rnc.py | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
python-stdnum