<s> from nose . tools import istest , assert_equal <EOL> from mammoth import html <EOL> @ istest <EOL> def text_nodes_with_text_are_not_stripped ( ) : <EOL> assert_equal ( <EOL> [ html . text ( "<STR_LIT:H>" ) ] , <EOL> html . strip_empty ( [ html . text ( "<STR_LIT:H>" ) ] ) ) <EOL> @ istest <EOL> def empty_text_nodes_are_stripped ( ) : <EOL> assert_equal ( <EOL> [ ] , <EOL> html . strip_empty ( [ html . text ( "<STR_LIT>" ) ] ) ) <EOL> @ istest <EOL> def elements_with_non_empty_children_are_not_stripped ( ) : <EOL> assert_equal ( <EOL> [ html . element ( "<STR_LIT:p>" , { } , [ html . text ( "<STR_LIT:H>" ) ] ) ] , <EOL> html . strip_empty ( [ html . element ( "<STR_LIT:p>" , { } , [ html . text ( "<STR_LIT:H>" ) ] ) ] ) ) <EOL> @ istest <EOL> def elements_with_no_children_are_stripped ( ) : <EOL> assert_equal ( <EOL> [ ] , <EOL> html . strip_empty ( [ html . element ( "<STR_LIT:p>" ) ] ) ) <EOL> @ istest <EOL> def elements_with_only_empty_children_are_stripped ( ) : <EOL> assert_equal ( <EOL> [ ] , <EOL> html . strip_empty ( [ html . element ( "<STR_LIT:p>" , { } , [ html . text ( "<STR_LIT>" ) ] ) ] ) ) <EOL> @ istest <EOL> def empty_children_are_removed ( ) : <EOL> assert_equal ( <EOL> html . strip_empty ( [ html . element ( "<STR_LIT>" , { } , [ <EOL> html . element ( "<STR_LIT>" , { } , [ html . text ( "<STR_LIT>" ) ] ) , <EOL> html . element ( "<STR_LIT>" , { } , [ html . text ( "<STR_LIT:H>" ) ] ) , <EOL> ] ) ] ) , <EOL> [ html . element ( "<STR_LIT>" , { } , [ <EOL> html . element ( "<STR_LIT>" , { } , [ html . text ( "<STR_LIT:H>" ) ] ) <EOL> ] ) ] ) <EOL> @ istest <EOL> def self_closing_elements_are_never_empty ( ) : <EOL> assert_equal ( <EOL> [ html . self_closing_element ( "<STR_LIT>" ) ] , <EOL> html . strip_empty ( [ html . self_closing_element ( "<STR_LIT>" ) ] ) ) <EOL> @ istest <EOL> def force_writes_are_never_empty ( ) : <EOL> assert_equal ( <EOL> [ html . force_write ] , <EOL> html . strip_empty ( [ html . force_write ] ) ) </s>
