def test_transform_badgerfish(self): handler = AttrDict(file=server.info.folder / 'dir/badgerfish.yaml') with (server.info.folder / 'dir/badgerfish.yaml').open(encoding='utf-8') as f: result = yield badgerfish(f.read(), handler) self.check('/dir/transform/badgerfish.yaml', text=result) self.check('/dir/transform/badgerfish.yaml', text='imported file α')
def test_transform(self): result = yield badgerfish(''' html: "@lang": en p: text div: p: text ''') eq_( result, '<!DOCTYPE html>\n<html lang="en"><p>text</p><div><p>text</p></div></html>')
def test_mapping(self): result = yield badgerfish(''' html: json: x: 1 y: 2 ''', mapping={ 'json': { 'function': 'json.dumps', 'kwargs': {'separators': [',', ':']}, } }) eq_( result, '<!DOCTYPE html>\n<html><json>{"x":1,"y":2}</json></html>')