Add __len__ to FieldDataCache
This commit is contained in:
@@ -951,3 +951,6 @@ class FieldDataCache(object):
|
||||
return None
|
||||
|
||||
return self.cache[key.scope].last_modified(key)
|
||||
|
||||
def __len__(self):
|
||||
return sum(len(cache) for cache in self.cache.values())
|
||||
|
||||
@@ -242,7 +242,7 @@ class TestMissingStudentModule(TestCase):
|
||||
|
||||
def test_set_field_in_missing_student_module(self):
|
||||
"Test that setting a field in a missing StudentModule creates the student module"
|
||||
self.assertEquals(0, sum(len(cache) for cache in self.field_data_cache.cache.values()))
|
||||
self.assertEquals(0, len(self.field_data_cache))
|
||||
self.assertEquals(0, StudentModule.objects.all().count())
|
||||
|
||||
# We are updating a problem, so we write to courseware_studentmodulehistory
|
||||
|
||||
Reference in New Issue
Block a user