From ae7eb2f79f0220ff9de5f39764d75d32e7a3e4b9 Mon Sep 17 00:00:00 2001 From: stv Date: Tue, 11 Nov 2014 17:07:05 -0800 Subject: [PATCH] Remove orphaned code --- lms/djangoapps/courseware/progress.py | 38 ----------- .../courseware/tests/test_progress.py | 67 ------------------- 2 files changed, 105 deletions(-) delete mode 100644 lms/djangoapps/courseware/progress.py delete mode 100644 lms/djangoapps/courseware/tests/test_progress.py diff --git a/lms/djangoapps/courseware/progress.py b/lms/djangoapps/courseware/progress.py deleted file mode 100644 index b9dd3fa781..0000000000 --- a/lms/djangoapps/courseware/progress.py +++ /dev/null @@ -1,38 +0,0 @@ -class completion(object): - def __init__(self, **d): - self.dict = dict({'duration_total': 0, - 'duration_watched': 0, - 'done': True, - 'questions_correct': 0, - 'questions_incorrect': 0, - 'questions_total': 0}) - if d: - self.dict.update(d) - - def __getitem__(self, key): - return self.dict[key] - - def __setitem__(self, key, value): - self.dict[key] = value - - def __add__(self, other): - result = dict(self.dict) - for item in ['duration_total', - 'duration_watched', - 'done', - 'questions_correct', - 'questions_incorrect', - 'questions_total']: - result[item] = result[item] + other.dict[item] - return completion(**result) - - def __contains__(self, key): - return key in dict - - def __repr__(self): - return repr(self.dict) - -if __name__ == '__main__': - dict1 = completion(duration_total=5) - dict2 = completion(duration_total=7) - print dict1 + dict2 diff --git a/lms/djangoapps/courseware/tests/test_progress.py b/lms/djangoapps/courseware/tests/test_progress.py deleted file mode 100644 index 743f936e68..0000000000 --- a/lms/djangoapps/courseware/tests/test_progress.py +++ /dev/null @@ -1,67 +0,0 @@ -from django.test import TestCase -from courseware import progress -from mock import MagicMock - - -class ProgessTests(TestCase): - def setUp(self): - - self.d = dict({ - 'duration_total': 0, - 'duration_watched': 0, - 'done': True, - 'questions_correct': 4, - 'questions_incorrect': 0, - 'questions_total': 0, - }) - - self.c = progress.completion() - self.c2 = progress.completion() - self.c2.dict = dict({ - 'duration_total': 0, - 'duration_watched': 0, - 'done': True, - 'questions_correct': 2, - 'questions_incorrect': 1, - 'questions_total': 0, - }) - - self.cplusc2 = dict({ - 'duration_total': 0, - 'duration_watched': 0, - 'done': True, - 'questions_correct': 2, - 'questions_incorrect': 1, - 'questions_total': 0, - }) - - self.oth = dict({ - 'duration_total': 0, - 'duration_watched': 0, - 'done': True, - 'questions_correct': 4, - 'questions_incorrect': 0, - 'questions_total': 7, - }) - - self.x = MagicMock() - self.x.dict = self.oth - - self.d_oth = { - 'duration_total': 0, - 'duration_watched': 0, - 'done': True, - 'questions_correct': 4, - 'questions_incorrect': 0, - 'questions_total': 7, - } - - def test_getitem(self): - self.assertEqual(self.c.__getitem__('duration_watched'), 0) - - def test_setitem(self): - self.c.__setitem__('questions_correct', 4) - self.assertEqual(str(self.c), str(self.d)) - - def test_repr(self): - self.assertEqual(self.c.__repr__(), str(progress.completion()))