<s> from expects import * <EOL> from booby import models , fields <EOL> from booby . inspection import get_fields , is_model <EOL> class TestGetFields ( object ) : <EOL> def test_should_return_model_instance_fields_dict ( self ) : <EOL> result = get_fields ( User ( ) ) <EOL> expect ( result ) . to ( have_keys ( name = User . name , email = User . email ) ) <EOL> def test_should_return_model_class_fields_dict ( self ) : <EOL> result = get_fields ( User ) <EOL> expect ( result ) . to ( have_keys ( name = User . name , email = User . email ) ) <EOL> def test_should_return_a_copy_of_internal_fields_dict ( self ) : <EOL> expect ( get_fields ( User ) ) . not_to ( be ( get_fields ( User ) ) ) <EOL> def test_non_model_object_should_raise_type_error ( self ) : <EOL> expect ( lambda : get_fields ( object ) ) . to ( raise_error ( TypeError ) ) <EOL> class TestIsModel ( object ) : <EOL> def test_should_return_true_if_object_is_a_model_instance ( self ) : <EOL> expect ( is_model ( User ( ) ) ) . to ( be_true ) <EOL> def test_should_return_true_if_object_is_a_model_subclass ( self ) : <EOL> expect ( is_model ( User ) ) . to ( be_true ) <EOL> def test_should_return_false_if_object_isnt_a_model_subclass ( self ) : <EOL> expect ( is_model ( object ) ) . to ( be_false ) <EOL> def test_should_return_false_if_object_isnt_a_model_instance ( self ) : <EOL> expect ( is_model ( object ( ) ) ) . to ( be_false ) <EOL> class User ( models . Model ) : <EOL> name = fields . String ( ) <EOL> email = fields . String ( ) </s>
