

def test_doctests_standin(self):
    self.l = List.objects.create(name='To Do')
    result = self.l.items.create(name='Write Tests').name
    expected_result = 'Write Tests'
    self.assertEqual(result, expected_result)
    result = list(self.l.items.values_list('name', 'position'))
    expected_result = [('Write Tests', 0)]
    self.assertEqual(result, expected_result)
    result = self.l.items.create(name='Exercise').name
    expected_result = 'Exercise'
    self.assertEqual(result, expected_result)
    result = list(self.l.items.values_list('name', 'position').order_by('position'))
    expected_result = [('Write Tests', 0), ('Exercise', 1)]
    self.assertEqual(result, expected_result)
    result = self.l.items.create(name='Learn to spell Exercise', position=0).name
    expected_result = 'Learn to spell Exercise'
    self.assertEqual(result, expected_result)
    result = list(self.l.items.values_list('name', 'position').order_by('position'))
    expected_result = [('Learn to spell Exercise', 0), ('Write Tests', 1), ('Exercise', 2)]
    self.assertEqual(result, expected_result)
    self.exercise = self.l.items.order_by('-position')[0]
    self.exercise.name = 'Exercise'
    self.exercise.save()
    result = list(self.l.items.values_list('name', 'position').order_by('position'))
    expected_result = [('Learn to spell Exercise', 0), ('Write Tests', 1), ('Exercise', 2)]
    self.assertEqual(result, expected_result)
    self.learn_to_spell = self.l.items.order_by('position')[0]
    self.learn_to_spell.delete()
    result = list(self.l.items.values_list('name', 'position').order_by('position'))
    expected_result = [('Write Tests', 0), ('Exercise', 1)]
    self.assertEqual(result, expected_result)
    result = self.l.items.create(name='Drink less Coke').name
    expected_result = 'Drink less Coke'
    self.assertEqual(result, expected_result)
    result = self.l.items.create(name='Go to Bed').name
    expected_result = 'Go to Bed'
    self.assertEqual(result, expected_result)
    result = list(self.l.items.values_list('name', 'position').order_by('position'))
    expected_result = [('Write Tests', 0), ('Exercise', 1), ('Drink less Coke', 2), ('Go to Bed', 3)]
    self.assertEqual(result, expected_result)
    i.write_tests = self.l.items.order_by('position')[0]
    self.write_tests.position = None
    self.write_tests.save()
    result = list(self.l.items.values_list('name', 'position').order_by('position'))
    expected_result = [('Exercise', 0), ('Drink less Coke', 1), ('Go to Bed', 2), ('Write Tests', 3)]
    self.assertEqual(result, expected_result)
    self.write_tests.position = (- 3)
    self.write_tests.save()
    result = list(self.l.items.values_list('name', 'position').order_by('position'))
    expected_result = [('Exercise', 0), ('Write Tests', 1), ('Drink less Coke', 2), ('Go to Bed', 3)]
    self.assertEqual(result, expected_result)
    self.write_tests.position = 2
    self.write_tests.save()
    result = list(self.l.items.values_list('name', 'position').order_by('position'))
    expected_result = [('Exercise', 0), ('Drink less Coke', 1), ('Write Tests', 2), ('Go to Bed', 3)]
    self.assertEqual(result, expected_result)
    self.sleep = self.l.items.order_by('-position')[0]
    self.sleep.position = 0
    self.sleep.save()
    result = list(self.l.items.values_list('name', 'position').order_by('position'))
    expected_result = [('Go to Bed', 0), ('Exercise', 1), ('Drink less Coke', 2), ('Write Tests', 3)]
    self.assertEqual(result, expected_result)
    time.sleep(1)
    (sleep_updated, exercise_updated, eat_better_updated, write_tests_updated) = [i.updated for i in self.l.items.order_by('position')]
    self.eat_better = self.l.items.order_by('-position')[1]
    self.eat_better.position = 1
    self.eat_better.save()
    self.todo_list = list(self.l.items.order_by('position'))
    result = (sleep_updated == self.todo_list[0].updated)
    expected_result = True
    self.assertEqual(result, expected_result)
    result = (eat_better_updated < self.todo_list[1].updated)
    expected_result = True
    self.assertEqual(result, expected_result)
    result = (exercise_updated < self.todo_list[2].updated)
    expected_result = True
    self.assertEqual(result, expected_result)
    result = (write_tests_updated == exercise_updated)
    expected_result = True
    self.assertEqual(result, expected_result)
    result = list(self.l.items.values_list('name', 'position').order_by('position'))
    expected_result = [('Go to Bed', 0), ('Drink less Coke', 1), ('Exercise', 2), ('Write Tests', 3)]
    self.assertEqual(result, expected_result)
    self.fix_issue_5 = Item(list=self.l, name='Fix Issue #5')
    result = self.fix_issue_5.position
    expected_result = (- 1)
    self.assertEqual(result, expected_result)
    self.fix_issue_5.position = (- 2)
    result = self.fix_issue_5.position
    expected_result = (- 2)
    self.assertEqual(result, expected_result)
    self.fix_issue_5.save()
    result = self.fix_issue_5.position
    expected_result = 3
    self.assertEqual(result, expected_result)
    result = list(self.l.items.values_list('name', 'position').order_by('position'))
    expected_result = [('Go to Bed', 0), ('Drink less Coke', 1), ('Exercise', 2), ('Fix Issue #5', 3), ('Write Tests', 4)]
    self.assertEqual(result, expected_result)
    self.fix_issue_5.position = (- 2)
    self.fix_issue_5.save()
    result = self.fix_issue_5.position
    expected_result = 3
    self.assertEqual(result, expected_result)
    result = list(self.l.items.values_list('name', 'position').order_by('position'))
    expected_result = [('Go to Bed', 0), ('Drink less Coke', 1), ('Exercise', 2), ('Fix Issue #5', 3), ('Write Tests', 4)]
    self.assertEqual(result, expected_result)
    self.item0 = self.l.items.create(name='Fix Issue #7', position=0)
    result = self.item0.position
    expected_result = 0
    self.assertEqual(result, expected_result)
    result = list(self.l.items.values_list('name', 'position').order_by('position'))
    expected_result = [('Fix Issue #7', 0), ('Go to Bed', 1), ('Drink less Coke', 2), ('Exercise', 3), ('Fix Issue #5', 4), ('Write Tests', 5)]
    self.assertEqual(result, expected_result)

dataset/ETHPy150Open jpwatts/django-positions/positions/examples/lists/tests.py GenericTestCase.test_doctests_standin/VarMisuse@540/804 `self`->`i`