Skip to content
This repository has been archived by the owner on Sep 14, 2018. It is now read-only.

Bugs hit by test_re.py (WAS: object returned by re.compile doesn't have method 'scanner' on it (CPython does have this method)) #504

Closed
ironpythonbot opened this issue Dec 9, 2014 · 1 comment

Comments

@ironpythonbot
Copy link

ISSUE #1

import re
c = re.compile(r";\s";)
dir(c)
['Equals', 'Finalize', 'GetHashCode', 'GetType', 'GetWeakRef',
'MemberwiseClone'
, 'SetWeakRef', 'ToString', ' ** class ** ', ' ** init ** ', ' ** module ** ',
' ** new ** ', 'f
indall', 'finditer', 'flags', 'groupindex', 'match', 'pattern', 'search',
'split
', 'sub', 'subn']

No method 'scanner'. This method is used in test_re.py

ISSUE #2
import re
m = re.match(";(?Pfirst) (?Psecond)";, ";first second";)
m.expand(r";\2 \1 \g \g";)
'second first '

Expected:
m = re.match(";(?Pfirst) (?Psecond)";, ";first second";)
m.expand(r";\2 \1 \g \g";)
'second first second first'

ISSUE #3
import re
re.match(r";(a)(?=\s\1)";, ";a a";).group(1)
Traceback (most recent call last):
File , line 0, in input##16
AttributeError: 'NoneType' object has no attribute 'group'

Expected:
re.match(r";(a)(?=\s\1)";, ";a a";).group(1)
'a'

ISSUE #4
test_re.py needs pickling...this is the test:

def test_pickling(self):

    import pickle
    self.pickle_test(pickle)
    import cPickle
    self.pickle_test(cPickle)





def pickle_test(self, pickle):
    oldpat = re.compile('a(?:b|(c|e){1,2}?|d)+?(.)')
    s = pickle.dumps(oldpat)
    newpat = pickle.loads(s)
    self.assertEqual(oldpat, newpat)

ISSUE #5

re.split(";(:*)";, ";:a:b::c";, 2)
['', ':', '', '', 'a:b::c']

Expected:
re.split(";(:*)";, ";:a:b::c";, 2)
['', ':', 'a', ':', 'b::c']

Work Item Details

Original CodePlex Issue: Issue 23666
Status: Active
Reason Closed: Unassigned
Assigned to: Unassigned
Reported on: Jul 27, 2009 at 11:08 PM
Reported by: dfugate
Updated on: Feb 22, 2013 at 2:13 AM
Updated by: jdhardy
Custom value: Reported internally at Microsoft.
CreatedDate: 4/26/2006
NewInternalID: 409450
OldInternalID: 148397
AreaPath: IronPython\Modules\RegEx

@slide
Copy link
Contributor

slide commented Jul 14, 2016

This is covered in #350

@slide slide closed this as completed Jul 14, 2016
@slide slide removed the untriaged label Jul 14, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants