def get_license(self): """Gets the terms of usage. An empty license means the terms are unknown. return: (osid.locale.DisplayText) - the license *compliance: mandatory -- This method must be implemented.* """ if 'license' in self._my_map: license_text = self._my_map['license'] return DisplayText(display_text_map=license_text) return DisplayText( text='', language_type=types.Language().get_type_data('DEFAULT'), format_type=types.Format().get_type_data('DEFAULT'), script_type=types.Script().get_type_data('DEFAULT'))
def display_text_test_wrapper(request): request.cls.display_text = DisplayText( display_text_map={ 'text': 'foo', 'languageTypeId': '639-2%3AHIN%40ISO', 'formatTypeId': 'TextFormats%3APLAIN%40okapia.net', 'scriptTypeId': '15924%3ADEVA%40ISO' })
def get_description(self): """Creates a description""" return DisplayText( text='Agent representing ' + str(self.id_), language_type=DEFAULT_LANGUAGE_TYPE, script_type=DEFAULT_SCRIPT_TYPE, format_type=DEFAULT_FORMAT_TYPE, )
def get_display_name(self): """Creates a display name""" return DisplayText( text=self.id_.get_identifier(), language_type=DEFAULT_LANGUAGE_TYPE, script_type=DEFAULT_SCRIPT_TYPE, format_type=DEFAULT_FORMAT_TYPE, )
def get_description(self): """Gets a description of this service implementation. return: (osid.locale.DisplayText) - a description *compliance: mandatory -- This method must be implemented.* """ return DisplayText( text=profile.DESCRIPTION, language_type=Type(**profile.LANGUAGETYPE), script_type=Type(**profile.SCRIPTTYPE), format_type=Type(**profile.FORMATTYPE))
def get_display_name(self): """Gets a display name for this service implementation. return: (osid.locale.DisplayText) - a display name *compliance: mandatory -- This method must be implemented.* """ return DisplayText( text = profile.DISPLAYNAME, language_type=Type(**profile.LANGUAGETYPE), script_type=Type(**profile.SCRIPTTYPE), format_type=Type(**profile.FORMATTYPE))
def test_can_create_display_text_with_kwargs(self): result = DisplayText( text='foo', language_type=Type('639-2%3AHIN%40ISO'), format_type=Type('TextFormats%3APLAIN%40okapia.net'), script_type=Type('15924%3ADEVA%40ISO')) assert result._text == 'foo' assert isinstance(result._language_type, Type) assert str(result._language_type) == '639-2%3AHIN%40ISO' assert isinstance(result._format_type, Type) assert str(result._format_type) == 'TextFormats%3APLAIN%40okapia.net' assert isinstance(result._script_type, Type) assert str(result._script_type) == '15924%3ADEVA%40ISO'
def test_can_create_display_text_with_map(self): result = DisplayText( display_text_map={ 'text': 'foo', 'languageTypeId': '639-2%3AHIN%40ISO', 'formatTypeId': 'TextFormats%3APLAIN%40okapia.net', 'scriptTypeId': '15924%3ADEVA%40ISO' }) assert result._text == 'foo' assert isinstance(result._language_type, Type) assert str(result._language_type) == '639-2%3AHIN%40ISO' assert isinstance(result._format_type, Type) assert str(result._format_type) == 'TextFormats%3APLAIN%40okapia.net' assert isinstance(result._script_type, Type) assert str(result._script_type) == '15924%3ADEVA%40ISO'
def get_feedback(self): if self.has_feedback(): return DisplayText( display_text_map=self.my_osid_object._my_map['feedback']) raise IllegalState()
def get_user_partition_id(self): return DisplayText(display_text_map=self.my_osid_object._my_map['texts']['userPartitionId'])
def get_org(self): return DisplayText(display_text_map=self.my_osid_object._my_map['texts']['org'])
def filename(self): return DisplayText(display_text_map=self.my_osid_object._my_map['texts']['fileName'])
def get_solution(self, parameters=None): """stub""" if not self.has_solution(): raise IllegalState() return DisplayText(self.my_osid_object._my_map['solution'])
def test_initer_raises_null_argument(self): with pytest.raises(errors.NullArgument): DisplayText()