Browse Source

fix a bug w/ decoding datetime's when there is a space in the data as

well...
python2
John-Mark Gurney 5 years ago
parent
commit
27ff594a26
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      pasn1.py

+ 2
- 1
pasn1.py View File

@@ -373,7 +373,7 @@ class ASN1Coder(object):
raise ValueError('last character must be Z') raise ValueError('last character must be Z')


# Real bug is in strptime, but work around it here. # Real bug is in strptime, but work around it here.
if ' ' in data:
if ' ' in ts:
raise ValueError('no spaces are allowed') raise ValueError('no spaces are allowed')


if '.' in ts: if '.' in ts:
@@ -601,6 +601,7 @@ class TestCode(unittest.TestCase):
set(), set((1,2,3)), set(), set((1,2,3)),
set((1,'sjlfdkj', None, float('inf'))), set((1,'sjlfdkj', None, float('inf'))),
datetime.datetime.utcnow(), datetime.datetime.utcnow(),
[ datetime.datetime.utcnow(), ' ' ],
datetime.datetime.utcnow().replace(microsecond=0), datetime.datetime.utcnow().replace(microsecond=0),
datetime.datetime.utcnow().replace(microsecond=1000), datetime.datetime.utcnow().replace(microsecond=1000),
]: ]:


Loading…
Cancel
Save