def test_1_etwikilibs(self): """Testing library functions provided by eazytext/__init__.py""" log.info("Testing library functions provided by eazytext/__init__.py") # escape_htmlchars text = 'first type, &, second type, ", third type, <, fourth type, >' text = escape_htmlchars(text) assert_true('&' in text, 'Mismatch in escape_htmlchars, for &') assert_true('"' in text, 'Mismatch in escape_htmlchars, for "') assert_true('<' in text, 'Mismatch in escape_htmlchars, for <') assert_true('>' in text, 'Mismatch in escape_htmlchars, for >') # split_style styletext1 = { 'border': '1px solid gray', 'display': 'none', 'style': 'border-radius : 2px', } styletext2 = { 'border': '1px solid gray', 'display': 'none', 'style': { 'display': 'block', 'style': 'border-radius : 4px' } } styletext3 = "margin-left : 10px" style, s_style = split_style(styletext1) assert_equal(style, { 'border': '1px solid gray', 'display': 'none' }, 'Mismatch in styletext1, style') assert_equal(s_style, 'border-radius : 2px', 'Mismatch in styletext1, s_style') style, s_style = split_style(styletext2) assert_equal(style, { 'border': '1px solid gray', 'display': 'block' }, 'Mismatch in styletext2, style') assert_equal(s_style, 'border-radius : 4px', 'Mismatch in styletext2, s_style') style, s_style = split_style(styletext3) assert_equal(style, {}, 'Mismatch in styletext3, style') assert_equal(s_style, 'margin-left : 10px', 'Mismatch in styletext3, s_style')
def test_1_etwikilibs( self ) : """Testing library functions provided by eazytext/__init__.py""" log.info( "Testing library functions provided by eazytext/__init__.py" ) # escape_htmlchars text = 'first type, &, second type, ", third type, <, fourth type, >' text = escape_htmlchars( text ) assert_true( '&' in text, 'Mismatch in escape_htmlchars, for &' ) assert_true( '"' in text, 'Mismatch in escape_htmlchars, for "' ) assert_true( '<' in text, 'Mismatch in escape_htmlchars, for <' ) assert_true( '>' in text, 'Mismatch in escape_htmlchars, for >' ) # split_style styletext1 = { 'border' : '1px solid gray', 'display' : 'none', 'style' : 'border-radius : 2px', } styletext2 = { 'border' : '1px solid gray', 'display' : 'none', 'style' : { 'display' : 'block', 'style' : 'border-radius : 4px' } } styletext3 = "margin-left : 10px" style, s_style = split_style( styletext1 ) assert_equal( style, { 'border' : '1px solid gray', 'display' : 'none' }, 'Mismatch in styletext1, style' ) assert_equal( s_style, 'border-radius : 2px', 'Mismatch in styletext1, s_style' ) style, s_style = split_style( styletext2 ) assert_equal( style, { 'border' : '1px solid gray', 'display' : 'block' }, 'Mismatch in styletext2, style' ) assert_equal( s_style, 'border-radius : 4px', 'Mismatch in styletext2, s_style' ) style, s_style = split_style( styletext3 ) assert_equal( style, {}, 'Mismatch in styletext3, style' ) assert_equal( s_style, 'margin-left : 10px', 'Mismatch in styletext3, s_style' )
def __init__( self, props, nowiki, *args ) : self.nowiki = nowiki self.title = props.pop( 'title', '' ) boxstyle = props.pop( 'style', {} ) titlestyle = props.pop( 'titlestyle', {} ) contentstyle = props.pop( 'contentstyle', '' ) d_style, s_style = split_style( boxstyle ) self.style = s_style self.css = {} self.css.update( props ) self.css.update( d_style ) d_style, s_style = split_style( titlestyle ) self.titlestyle = s_style self.title_css = {} self.title_css.update( d_style ) d_style, s_style = split_style( contentstyle ) self.contentstyle = s_style self.cont_css = {} self.cont_css.update( d_style ) self.hide = 'hide' in args
def __init__(self, props, nowiki, *args): self.nowiki = nowiki self.title = props.pop('title', '') boxstyle = props.pop('style', {}) titlestyle = props.pop('titlestyle', {}) contentstyle = props.pop('contentstyle', '') d_style, s_style = split_style(boxstyle) self.style = s_style self.css = {} self.css.update(props) self.css.update(d_style) d_style, s_style = split_style(titlestyle) self.titlestyle = s_style self.title_css = {} self.title_css.update(d_style) d_style, s_style = split_style(contentstyle) self.contentstyle = s_style self.cont_css = {} self.cont_css.update(d_style) self.hide = 'hide' in args