def test_get_skill_from_model_with_description(self) -> None: skill = skill_fetchers.get_skill_by_description('Description') # Ruling out the possibility of None for mypy type checking. assert skill is not None self.assertEqual( skill.to_dict(), # type: ignore[no-untyped-call] self.skill.to_dict() ) self.assertEqual( skill_fetchers.get_skill_by_description('Does not exist'), None )
def does_skill_with_description_exist(description): """Checks if skill with provided description exists. Args: description: str. The description for the skill. Returns: bool. Whether the the description for the skill exists. """ existing_skill = (skill_fetchers.get_skill_by_description(description)) return existing_skill is not None
def test_initialize_structures_are_valid(self): self.post_json('/initialize_android_test_data', {}, use_payload=False, csrf_token=None) exp_id = '26' topic = topic_fetchers.get_topic_by_name('Android test') exploration = exp_fetchers.get_exploration_by_id(exp_id) story = story_fetchers.get_story_by_url_fragment( 'android-end-to-end-testing') skill = skill_fetchers.get_skill_by_description( 'Dummy Skill for Android') skill.validate() story.validate() topic.validate(strict=True) exploration.validate(strict=True) for node in story.story_contents.nodes: self.assertEqual(node.exploration_id, exp_id)
def test_get_skill_from_model_with_description(self): self.assertEqual( skill_fetchers.get_skill_by_description('Description').to_dict(), self.skill.to_dict()) self.assertEqual( skill_fetchers.get_skill_by_description('Does not exist'), None)