def test_get_mutable_mark_dirty():
 class MutableTester(XBlock, ):
  'Test class with mutable fields.'
  list_field = List(default=[])
 mutable_test = MutableTester(TestRuntime(services={'field-data': DictFieldData({})}), scope_ids=Mock(spec=ScopeIds))
 assert_equals(len(mutable_test._dirty_fields), 0)
 _test_get = mutable_test.list_field
 assert_equals(len(mutable_test._dirty_fields), 1)
 mutable_test.list_field = []
 assert_equals(len(mutable_test._dirty_fields), 1)
 mutable_test.save()
 assert_equals(len(mutable_test._dirty_fields), 1)
 _test_get = mutable_test.list_field
 assert_equals(len(mutable_test._dirty_fields), 1)

def test_get_mutable_mark_dirty ( ) : class MutableTester ( XBlock , ) : list_field = List ( default = [ ] ) mutable_test = MutableTester ( TestRuntime ( services = { 'field-data' : DictFieldData ( { } ) } ) , scope_ids = Mock ( spec = ScopeIds ) ) assert_equals ( len ( mutable_test . _dirty_fields ) , 0 ) _test_get = mutable_test . list_field assert_equals ( len ( mutable_test . _dirty_fields ) , 1 ) mutable_test . list_field = [ ] assert_equals ( len ( mutable_test . _dirty_fields ) , 1 ) mutable_test . save ( ) assert_equals ( len ( mutable_test . _dirty_fields ) , 1 ) _test_get = mutable_test . list_field assert_equals ( len ( mutable_test . _dirty_fields ) , 1 )
ensure that accessing a mutable field type does not mark it dirty if the field has never been set .