Ticket #143 (new defect)

Opened 4 years ago

implicit_resolver does not work with literal block scalars, here is the test

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


import yaml import re

s = """ good: foo bad: |


class Test(yaml.YAMLObject):

yaml_tag = '!test' pattern = re.compile(r'foo') yaml.add_implicit_resolver('!test', pattern)

def init(self, s):

self.s = s

def repr(self):

return 'Test(%s)' % self.s

@classmethod def from_yaml(cls, loader, node):

value = loader.construct_scalar(node) return cls(value)

print yaml.load(s) # emits>> {'bad': 'foo', 'good': Test(foo)}

Attachments Download (476 bytes) - added by berlin_lev@… 4 years ago.
test to reproduce the error

Change History

Changed 4 years ago by berlin_lev@…

test to reproduce the error


Add a comment

Modify Ticket

Change Properties
<Author field>
as new
as The resolution will be set. Next status will be 'closed'
to The owner will be changed from xi. Next status will be 'new'
The owner will be changed from xi to anonymous. Next status will be 'assigned'

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

Note: See TracTickets for help on using tickets.