<s> from json import loads <EOL> from weblib . structured import Structure as x <EOL> from test . util import build_grab <EOL> from test . util import BaseGrabTestCase <EOL> XML = b'''<STR_LIT>''' <EOL> class StructuredExtensionTest ( BaseGrabTestCase ) : <EOL> def setUp ( self ) : <EOL> self . g = build_grab ( document_body = XML ) <EOL> def test_1 ( self ) : <EOL> result = self . g . doc . structure ( <EOL> '<STR_LIT>' , <EOL> title = '<STR_LIT>' , <EOL> date = '<STR_LIT>' , <EOL> about = '<STR_LIT>' , <EOL> number = ( '<STR_LIT>' , int ) , <EOL> home_url = '<STR_LIT>' , <EOL> ) <EOL> self . assertEqual ( <EOL> result , <EOL> loads ( '''<STR_LIT>''' ) <EOL> ) <EOL> def test_2 ( self ) : <EOL> result = self . g . doc . structure ( <EOL> '<STR_LIT>' , <EOL> x ( <EOL> '<STR_LIT>' , <EOL> description = ( '<STR_LIT>' , <EOL> lambda item : '<STR_LIT:U+0020>' . join ( item . split ( ) ) ) , <EOL> detail_number = ( '<STR_LIT>' , int ) <EOL> ) , <EOL> title = '<STR_LIT>' , <EOL> date = '<STR_LIT>' , <EOL> ) <EOL> self . assertEqual ( <EOL> result , <EOL> loads ( '''<STR_LIT>''' ) <EOL> ) <EOL> def test_3 ( self ) : <EOL> result = self . g . doc . structure ( <EOL> '<STR_LIT>' , <EOL> home_url = '<STR_LIT>' , <EOL> articles = x ( <EOL> '<STR_LIT>' , <EOL> id = '<STR_LIT>' , <EOL> title = '<STR_LIT>' , <EOL> url = '<STR_LIT>' , <EOL> hotkeys = x ( <EOL> '<STR_LIT>' , <EOL> hotkey = '<STR_LIT>' <EOL> ) <EOL> ) <EOL> ) <EOL> self . assertEqual ( <EOL> result , <EOL> loads ( '''<STR_LIT>''' ) <EOL> ) </s>
