def test_AsVersion(self): adef = ActivityDefinition( { "description": {"en-US": "test"}, "name": {"en-US": "test"}, "type": "test", "more_info": "test", "interaction_type": "choice", "correct_responses_pattern": ["test"], "choices": InteractionComponentList(), "scale": InteractionComponentList(), "source": InteractionComponentList(), "target": InteractionComponentList(), "steps": InteractionComponentList(), "extensions": {"test": "test"}, } ) adef2 = adef.as_version() self.assertEqual( adef2, { "name": {"en-US": "test"}, "correctResponsesPattern": ["test"], "scale": [], "description": {"en-US": "test"}, "choices": [], "source": [], "steps": [], "moreInfo": "test", "extensions": {"test": "test"}, "interactionType": "choice", "target": [], "type": "test", }, )
def test_AsVersion(self): adef = ActivityDefinition({ 'description': {'en-US': 'test'}, 'name': {'en-US': 'test'}, 'type': 'test', 'more_info': 'test', 'interaction_type': 'choice', 'correct_responses_pattern': ['test'], 'choices': InteractionComponentList(), 'scale': InteractionComponentList(), 'source': InteractionComponentList(), 'target': InteractionComponentList(), 'steps': InteractionComponentList(), 'extensions': {'test': 'test'} }) adef2 = adef.as_version() self.assertEqual(adef2, { "name": {"en-US": "test"}, "correctResponsesPattern": ["test"], "scale": [], "description": {"en-US": "test"}, "choices": [], "source": [], "steps": [], "moreInfo": "test", "extensions": {"test": "test"}, "interactionType": "choice", "target": [], "type": "test", })
def test_AsVersionIgnoreNone(self): adef = ActivityDefinition({ 'description': {'en-US': 'test'}, 'more_info': None }) self.assertEqual(adef.description, {'en-US': 'test'}) self.assertIsNone(adef.more_info) adef2 = adef.as_version() self.assertEqual(adef2, {'description': {'en-US': 'test'}})
def test_AsVersionEmpty(self): adef = ActivityDefinition() adef2 = adef.as_version() self.assertEqual(adef2, {})
def test_AsVersionIgnoreNone(self): adef = ActivityDefinition({"description": {"en-US": "test"}, "more_info": None}) self.assertEqual(adef.description, {"en-US": "test"}) self.assertIsNone(adef.more_info) adef2 = adef.as_version() self.assertEqual(adef2, {"description": {"en-US": "test"}})