def test_1(self): correct_answer = {'1': [[40, 10], 29], 'name_with_icon': [20, 20]} user_input = '[{"1": [10, 10]}, {"name_with_icon": [20, 20]}]' dnd = draganddrop.DragAndDrop(correct_answer, user_input) correct_groups = [['1'], ['name_with_icon']] correct_positions = [{'exact': [[[40, 10], 29]]}, {'exact': [[20, 20]]}] user_groups = [['1'], ['name_with_icon']] user_positions = [{'user': [[10, 10]]}, {'user': [[20, 20]]}] self.assertEqual(correct_groups, dnd.correct_groups) self.assertEqual(correct_positions, dnd.correct_positions) self.assertEqual(user_groups, dnd.user_groups) self.assertEqual(user_positions, dnd.user_positions)
def test_7(self): dnd = draganddrop.DragAndDrop({'1': 't1'}, '[{"1": "t1"}]') self.assertFalse( dnd.compare_positions(correct=["a", "b", "b"], user=["a", "c", "b"], flag='anyof'))
def test_2b(self): dnd = draganddrop.DragAndDrop({'1': 't1'}, '[{"1": "t1"}]') self.assertFalse( dnd.compare_positions(correct=[[1, 1], [2, 3]], user=[[2, 13], [1, 1]], flag='exact'))
def test_1(self): dnd = draganddrop.DragAndDrop({'1': 't1'}, '[{"1": "t1"}]') self.assertTrue( dnd.compare_positions(correct=[[1, 1], [2, 3]], user=[[2, 3], [1, 1]], flag='anyof'))