@@ -217,6 +217,27 @@ def test_form_list_pop_regression(self):
217217 instance .steps .first
218218 self .assertEqual (instance .get_form_list (), OrderedDict ([('start' , Step1 )]))
219219
220+ def test_cleaned_data_caching (self ):
221+ class TrackedStep1 (Step1 ):
222+ instantiation_count = 0
223+
224+ def __init__ (self , * args , ** kwargs ):
225+ TrackedStep1 .instantiation_count += 1
226+ super ().__init__ (* args , ** kwargs )
227+
228+ testform = TestWizard .as_view ([('start' , TrackedStep1 ), ('step2' , Step2 )])
229+ request = get_request ({
230+ 'test_wizard-current_step' : 'start' ,
231+ 'start-name' : 'test'
232+ })
233+ response , instance = testform (request )
234+ TrackedStep1 .instantiation_count = 0
235+ cleaned_data_1 = instance .get_cleaned_data_for_step ('start' )
236+ cleaned_data_2 = instance .get_cleaned_data_for_step ('start' )
237+ self .assertEqual (TrackedStep1 .instantiation_count , 1 )
238+ self .assertEqual (cleaned_data_1 , cleaned_data_2 )
239+ self .assertTrue (hasattr (instance , '_cleaned_data_cache_start' ))
240+
220241 def test_form_condition_unstable (self ):
221242 request = get_request ()
222243 testform = TestWizard .as_view (
0 commit comments