Ticket #119 (new defect)

Opened 3 years ago

Implicit resolver is not respected (the order is important)

Reported by: py4fun@… Owned by: xi
Priority: normal Component: pyyaml
Severity: normal Keywords:
Cc:

Description

The order in which the implicit resolvers are applied is important. The user defined implicit resolvers should be checked first.

In the test below '1.00' should parsed as string but instead it is parsed as float:

    def test1(self):
        pattern = re.compile(r"\d\.\d\d")
        yaml.add_implicit_resolver("tag:yaml.org,2002:str", pattern, "123")
        t = yaml.load("version: 1.00")
        print t
        self.assertEquals('1.00', t['version'])
test1 (java.TestJava) ... {'version': 1.0}
FAIL

======================================================================
FAIL: test1 (java.TestJava)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:/projects/py-workspace/imp-resolver/tests\java.py", line 15, in test1
    self.assertEquals('1.00', t['version'])
AssertionError: '1.00' != 1.0

Attachments

Add/Change #119 (Implicit resolver is not respected (the order is important))

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from xi. Next status will be 'new'
The owner will change from xi to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.