def testSingleChallenge(self): pathway = LearningPathway() first_node = ChallengeNode(Challenge("first")) pathway.start.add_after(first_node) self.assertEqual(pathway.start.after, first_node) self.assertEqual(pathway.start, first_node.before) self.assertEqual(pathway.finish.before, first_node) self.assertEqual(pathway.finish, first_node.after) # overriding the node's complete() function to test pathway behaviour first_node.complete = dummy_complete_true self.assertTrue(pathway.complete()) first_node.complete = dummy_complete_false self.assertFalse(pathway.complete())
def testEmptyPathway(self): pathway = LearningPathway() self.assertEqual(pathway.start.after, pathway.finish) self.assertEqual(pathway.finish.before, pathway.start) self.assertTrue(pathway.complete())
next_node = next_node.after bottom_list = [] next_node = node.first.bottom.after last = node.last.bottom while next_node is not last: bottom_list.append(node_to_list(next_node)) next_node = next_node.after return [top_list, bottom_list] if __name__ == "__main__": # this test is to try out the learning pathway as I make it pathway = LearningPathway() # add a challenge node after the start first_challenge = Challenge("first") first_node = ChallengeNode(challenge=first_challenge) pathway.start.add_after(first_node) print pathway_to_list(pathway) second_challenge = Challenge("second") second_node = ChallengeNode(challenge=second_challenge) first_node.add_after(second_node) print pathway_to_list(pathway) # add a challenge node before the end