<s> import pytest <EOL> import handwritingio <EOL> def test_list_handwritings ( client ) : <EOL> hws = client . list_handwritings ( ) <EOL> assert hws <EOL> def test_list_handwriting_limit ( client ) : <EOL> hws = client . list_handwritings ( { '<STR_LIT>' : <NUM_LIT:1> } ) <EOL> assert len ( hws ) == <NUM_LIT:1> <EOL> def test_list_handwritings_validation ( client ) : <EOL> with pytest . raises ( handwritingio . ValidationError ) as exc_info : <EOL> client . list_handwritings ( { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> assert '<STR_LIT>' in repr ( exc_info . value ) <EOL> def test_get_handwriting ( client , test_handwriting ) : <EOL> hw = client . get_handwriting ( test_handwriting [ '<STR_LIT:id>' ] ) <EOL> assert hw == test_handwriting <EOL> def test_get_handwriting_not_found ( client ) : <EOL> with pytest . raises ( handwritingio . APIError ) as exc_info : <EOL> client . get_handwriting ( '<STR_LIT>' ) <EOL> assert '<STR_LIT>' in repr ( exc_info . value ) <EOL> def test_render_png ( client , test_handwriting ) : <EOL> image = client . render_png ( { <EOL> '<STR_LIT>' : test_handwriting [ '<STR_LIT:id>' ] , <EOL> '<STR_LIT:text>' : '<STR_LIT>' , <EOL> } ) <EOL> assert image <EOL> assert isinstance ( image , bytes ) <EOL> def test_render_png_missing_text ( client , test_handwriting ) : <EOL> with pytest . raises ( handwritingio . ValidationError ) as exc_info : <EOL> client . render_png ( { <EOL> '<STR_LIT>' : test_handwriting [ '<STR_LIT:id>' ] , <EOL> } ) <EOL> assert '<STR_LIT:text>' in repr ( exc_info . value ) <EOL> def test_render_png_made_up_hw ( client ) : <EOL> with pytest . raises ( handwritingio . ValidationError ) as exc_info : <EOL> client . render_png ( { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:text>' : '<STR_LIT:foo>' , <EOL> } ) <EOL> assert '<STR_LIT>' in repr ( exc_info . value ) <EOL> def test_render_png_param_validation ( client , test_handwriting ) : <EOL> with pytest . raises ( handwritingio . ValidationError ) as exc_info : <EOL> client . render_png ( { <EOL> '<STR_LIT>' : test_handwriting [ '<STR_LIT:id>' ] , <EOL> '<STR_LIT:text>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } ) <EOL> assert '<STR_LIT>' in repr ( exc_info . value ) <EOL> def test_render_png_multiple_errors ( client ) : <EOL> with pytest . raises ( handwritingio . ValidationError ) as exc_info : <EOL> client . render_png ( { <EOL> } ) <EOL> assert exc_info . value . errors <EOL> assert len ( exc_info . value . errors ) == <NUM_LIT:2> <EOL> def test_render_pdf ( client , test_handwriting ) : <EOL> image = client . render_pdf ( { <EOL> '<STR_LIT>' : test_handwriting [ '<STR_LIT:id>' ] , <EOL> '<STR_LIT:text>' : '<STR_LIT>' , <EOL> } ) <EOL> assert image <EOL> assert isinstance ( image , bytes ) <EOL> def test_bad_auth ( client ) : <EOL> client . session . auth = ( '<STR_LIT:foo>' , '<STR_LIT:bar>' ) <EOL> with pytest . raises ( handwritingio . AuthorizationError ) : <EOL> client . list_handwritings ( ) </s>
