<s> from py . test import raises <EOL> from graphene . contrib . sqlalchemy import SQLAlchemyObjectType <EOL> from tests . utils import assert_equal_lists <EOL> from . models import Reporter <EOL> def test_should_raise_if_no_model ( ) : <EOL> with raises ( Exception ) as excinfo : <EOL> class Character1 ( SQLAlchemyObjectType ) : <EOL> pass <EOL> assert '<STR_LIT>' in str ( excinfo . value ) <EOL> def test_should_raise_if_model_is_invalid ( ) : <EOL> with raises ( Exception ) as excinfo : <EOL> class Character2 ( SQLAlchemyObjectType ) : <EOL> class Meta : <EOL> model = <NUM_LIT:1> <EOL> assert '<STR_LIT>' in str ( excinfo . value ) <EOL> def test_should_map_fields_correctly ( ) : <EOL> class ReporterType2 ( SQLAlchemyObjectType ) : <EOL> class Meta : <EOL> model = Reporter <EOL> assert_equal_lists ( <EOL> ReporterType2 . _meta . fields_map . keys ( ) , <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:email>' , '<STR_LIT>' , '<STR_LIT:id>' ] <EOL> ) <EOL> def test_should_map_only_few_fields ( ) : <EOL> class Reporter2 ( SQLAlchemyObjectType ) : <EOL> class Meta : <EOL> model = Reporter <EOL> only_fields = ( '<STR_LIT:id>' , '<STR_LIT:email>' ) <EOL> assert_equal_lists ( <EOL> Reporter2 . _meta . fields_map . keys ( ) , <EOL> [ '<STR_LIT:id>' , '<STR_LIT:email>' ] <EOL> ) </s>
