Modify ↓
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: | |
| Cc: |
Description
import yaml import re
s = """ good: foo bad: |
foo"""
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
Note: See
TracTickets for help on using
tickets.


test to reproduce the error