<s> from nose . tools import * <EOL> from nose . plugins . skip import SkipTest <EOL> from git_orm . testcases import GitTestCase <EOL> from git_orm import models <EOL> from git_orm . models import Q <EOL> class Ticket ( models . Model ) : <EOL> title = models . TextField ( ) <EOL> class User ( models . Model ) : <EOL> name = models . TextField ( ) <EOL> class TestModelBase ( GitTestCase ) : <EOL> def test_exceptions ( self ) : <EOL> for exc_class in models . base . MODEL_EXCEPTIONS : <EOL> model_exc_class = getattr ( Ticket , exc_class . __name__ ) <EOL> ok_ ( issubclass ( model_exc_class , exc_class ) ) <EOL> def test_storage_name ( self ) : <EOL> eq_ ( Ticket . _meta . storage_name , '<STR_LIT>' ) <EOL> def test_objects ( self ) : <EOL> eq_ ( Ticket . objects . model , Ticket ) <EOL> eq_ ( Ticket . objects . query , Q ( ) ) <EOL> def test_new ( self ) : <EOL> ticket = Ticket ( ) <EOL> eq_ ( ticket . title , None ) <EOL> def test_equality ( self ) : <EOL> ticket = Ticket ( ) <EOL> ticket2 = Ticket ( id = ticket . id ) <EOL> eq_ ( ticket , ticket2 ) <EOL> def test_equality_unequal ( self ) : <EOL> assert_not_equal ( Ticket ( ) , Ticket ( ) ) <EOL> def test_equality_other_model ( self ) : <EOL> assert_not_equal ( Ticket ( ) , User ( ) ) <EOL> def test_new_with_argument ( self ) : <EOL> ticket = Ticket ( title = '<STR_LIT>' ) <EOL> eq_ ( ticket . title , '<STR_LIT>' ) <EOL> def test_new_with_invalid_argument ( self ) : <EOL> assert_raises ( TypeError , Ticket , bar = '<STR_LIT>' ) <EOL> def test_path_with_pk_none ( self ) : <EOL> ticket = Ticket ( pk = None ) <EOL> assert_raises ( ValueError , lambda : ticket . path ) <EOL> def test_path ( self ) : <EOL> ticket = Ticket ( title = '<STR_LIT>' ) <EOL> eq_ ( ticket . path , [ '<STR_LIT>' , ticket . id ] ) <EOL> def test_save ( self ) : <EOL> self . assert_commit_count ( <NUM_LIT:0> ) <EOL> ticket = Ticket ( title = '<STR_LIT>' ) <EOL> self . assert_commit_count ( <NUM_LIT:0> ) <EOL> ticket . save ( ) <EOL> self . assert_commit_count ( <NUM_LIT:1> ) <EOL> self . assert_file_exists ( '<STR_LIT:/>' . join ( ticket . path ) ) <EOL> def test_delete ( self ) : <EOL> raise SkipTest ( '<STR_LIT>' ) <EOL> def test_create ( self ) : <EOL> self . assert_commit_count ( <NUM_LIT:0> ) <EOL> ticket = Ticket . create ( title = '<STR_LIT>' ) <EOL> self . assert_commit_count ( <NUM_LIT:1> ) <EOL> self . assert_file_exists ( '<STR_LIT:/>' . join ( ticket . path ) ) </s>
