def test_stupid_rotate(self): insert_question({"num": 0}, -2) self.assertNumKey(1, 0) self.assertIdKey(0, ex.nq1["_id"]) self.assertIdKey(2, ex.nq2["_id"])
def test_disable2(self): insert_question({}) self.assertTrue(disable_question_in_list(ex.nq2["_id"])) self.assertEqual(ex.nq1["_id"], get_question_by_idx(0)["_id"]) self.assertTrue("question" not in get_question_by_idx(1))
def test_insert_gap_error_neg(self): with self.assertRaises(IndexError): insert_question({"new": True}, idx=-3)
def add_q(l, idx=-1): out = [] for x in l: insert_question({"num": x}, idx) return out
def test_insert_random(self): insert_question({"new": True}, idx=1) self.assertTrue(get_question_by_idx(1)["new"])