@@ -327,7 +327,9 @@ def test_register_no_args(self):
327327 self .assertEqual (len (choice .history .all ()), 1 )
328328
329329 def test_register_separate_app (self ):
330- get_history = lambda model : model .history
330+ def get_history (model ):
331+ return model .history
332+
331333 self .assertRaises (AttributeError , get_history , User )
332334 self .assertEqual (len (User .histories .all ()), 0 )
333335 user = User .objects .create (username = 'bob' , password = 'pass' )
@@ -471,7 +473,10 @@ def test_as_of(self):
471473 most_recent = poll .history .most_recent ()
472474 self .assertEqual (most_recent .question , "why?" )
473475 times = [r .history_date for r in poll .history .all ()]
474- question_as_of = lambda time : poll .history .as_of (time ).question
476+
477+ def question_as_of (time ):
478+ return poll .history .as_of (time ).question
479+
475480 self .assertEqual (question_as_of (times [0 ]), "why?" )
476481 self .assertEqual (question_as_of (times [1 ]), "how's it going?" )
477482 self .assertEqual (question_as_of (times [2 ]), "what's up?" )
@@ -495,7 +500,10 @@ def test_foreignkey_field(self):
495500 most_recent = choice .history .most_recent ()
496501 self .assertEqual (most_recent .poll .pk , how_poll .pk )
497502 times = [r .history_date for r in choice .history .all ()]
498- poll_as_of = lambda time : choice .history .as_of (time ).poll
503+
504+ def poll_as_of (time ):
505+ return choice .history .as_of (time ).poll
506+
499507 self .assertEqual (poll_as_of (times [0 ]).pk , how_poll .pk )
500508 self .assertEqual (poll_as_of (times [1 ]).pk , why_poll .pk )
501509
@@ -788,41 +796,59 @@ class TestTrackingInheritance(TestCase):
788796
789797 def test_tracked_abstract_base (self ):
790798 self .assertEqual (
791- [f .attname for f in TrackedWithAbstractBase .history .model ._meta .fields ],
792- ['id' , 'history_id' , 'history_date' , 'history_user_id' , 'history_type' ],
799+ [
800+ f .attname
801+ for f in TrackedWithAbstractBase .history .model ._meta .fields
802+ ],
803+ [
804+ 'id' , 'history_id' , 'history_date' , 'history_user_id' ,
805+ 'history_type' ,
806+ ],
793807 )
794808
795809 def test_tracked_concrete_base (self ):
796810 self .assertEqual (
797- [f .attname for f in TrackedWithConcreteBase .history .model ._meta .fields ],
798- ['id' , 'trackedconcretebase_ptr_id' , 'history_id' , 'history_date' , 'history_user_id' , 'history_type' ],
811+ [
812+ f .attname
813+ for f in TrackedWithConcreteBase .history .model ._meta .fields
814+ ],
815+ [
816+ 'id' , 'trackedconcretebase_ptr_id' , 'history_id' ,
817+ 'history_date' , 'history_user_id' , 'history_type' ,
818+ ],
799819 )
800820
801821 def test_multiple_tracked_bases (self ):
802822 with self .assertRaises (exceptions .MultipleRegistrationsError ):
803- class TrackedWithMultipleAbstractBases (TrackedAbstractBaseA , TrackedAbstractBaseB ):
823+ class TrackedWithMultipleAbstractBases (
824+ TrackedAbstractBaseA , TrackedAbstractBaseB ):
804825 pass
805826
806827 def test_tracked_abstract_and_untracked_concrete_base (self ):
807828 self .assertEqual (
808829 [f .attname for f in InheritTracking1 .history .model ._meta .fields ],
809- ['id' , 'untrackedconcretebase_ptr_id' , 'history_id' , 'history_date' , 'history_user_id' , 'history_type' ],
830+ [
831+ 'id' , 'untrackedconcretebase_ptr_id' , 'history_id' ,
832+ 'history_date' , 'history_user_id' , 'history_type' ,
833+ ],
810834 )
811835
812836 def test_indirect_tracked_abstract_base (self ):
813837 self .assertEqual (
814838 [f .attname for f in InheritTracking2 .history .model ._meta .fields ],
815839 [
816- 'id' , 'baseinherittracking2_ptr_id' ,
817- 'history_id' , 'history_date' , 'history_user_id' , 'history_type' ],
840+ 'id' , 'baseinherittracking2_ptr_id' , 'history_id' ,
841+ 'history_date' , 'history_user_id' , 'history_type' ,
842+ ],
818843 )
819844
820845 def test_indirect_tracked_concrete_base (self ):
821846 self .assertEqual (
822847 [f .attname for f in InheritTracking3 .history .model ._meta .fields ],
823848 [
824- 'id' , 'baseinherittracking3_ptr_id' ,
825- 'history_id' , 'history_date' , 'history_user_id' , 'history_type' ],
849+ 'id' , 'baseinherittracking3_ptr_id' , 'history_id' ,
850+ 'history_date' , 'history_user_id' , 'history_type' ,
851+ ],
826852 )
827853
828854 def test_registering_with_tracked_abstract_base (self ):
0 commit comments