@@ -327,7 +327,9 @@ def test_register_no_args(self):
327
327
self .assertEqual (len (choice .history .all ()), 1 )
328
328
329
329
def test_register_separate_app (self ):
330
- get_history = lambda model : model .history
330
+ def get_history (model ):
331
+ return model .history
332
+
331
333
self .assertRaises (AttributeError , get_history , User )
332
334
self .assertEqual (len (User .histories .all ()), 0 )
333
335
user = User .objects .create (username = 'bob' , password = 'pass' )
@@ -471,7 +473,10 @@ def test_as_of(self):
471
473
most_recent = poll .history .most_recent ()
472
474
self .assertEqual (most_recent .question , "why?" )
473
475
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
+
475
480
self .assertEqual (question_as_of (times [0 ]), "why?" )
476
481
self .assertEqual (question_as_of (times [1 ]), "how's it going?" )
477
482
self .assertEqual (question_as_of (times [2 ]), "what's up?" )
@@ -495,7 +500,10 @@ def test_foreignkey_field(self):
495
500
most_recent = choice .history .most_recent ()
496
501
self .assertEqual (most_recent .poll .pk , how_poll .pk )
497
502
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
+
499
507
self .assertEqual (poll_as_of (times [0 ]).pk , how_poll .pk )
500
508
self .assertEqual (poll_as_of (times [1 ]).pk , why_poll .pk )
501
509
@@ -788,41 +796,59 @@ class TestTrackingInheritance(TestCase):
788
796
789
797
def test_tracked_abstract_base (self ):
790
798
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
+ ],
793
807
)
794
808
795
809
def test_tracked_concrete_base (self ):
796
810
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
+ ],
799
819
)
800
820
801
821
def test_multiple_tracked_bases (self ):
802
822
with self .assertRaises (exceptions .MultipleRegistrationsError ):
803
- class TrackedWithMultipleAbstractBases (TrackedAbstractBaseA , TrackedAbstractBaseB ):
823
+ class TrackedWithMultipleAbstractBases (
824
+ TrackedAbstractBaseA , TrackedAbstractBaseB ):
804
825
pass
805
826
806
827
def test_tracked_abstract_and_untracked_concrete_base (self ):
807
828
self .assertEqual (
808
829
[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
+ ],
810
834
)
811
835
812
836
def test_indirect_tracked_abstract_base (self ):
813
837
self .assertEqual (
814
838
[f .attname for f in InheritTracking2 .history .model ._meta .fields ],
815
839
[
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
+ ],
818
843
)
819
844
820
845
def test_indirect_tracked_concrete_base (self ):
821
846
self .assertEqual (
822
847
[f .attname for f in InheritTracking3 .history .model ._meta .fields ],
823
848
[
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
+ ],
826
852
)
827
853
828
854
def test_registering_with_tracked_abstract_base (self ):
0 commit comments