Esempio n. 1
0
    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'))
Esempio n. 2
0
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'
        })
Esempio n. 3
0
 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,
     )
Esempio n. 4
0
 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,
     )
Esempio n. 5
0
    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))
Esempio n. 6
0
    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))
Esempio n. 7
0
 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'
Esempio n. 8
0
 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'
Esempio n. 9
0
 def get_feedback(self):
     if self.has_feedback():
         return DisplayText(
             display_text_map=self.my_osid_object._my_map['feedback'])
     raise IllegalState()
Esempio n. 10
0
 def get_user_partition_id(self):
     return DisplayText(display_text_map=self.my_osid_object._my_map['texts']['userPartitionId'])
Esempio n. 11
0
 def get_org(self):
     return DisplayText(display_text_map=self.my_osid_object._my_map['texts']['org'])
Esempio n. 12
0
 def filename(self):
     return DisplayText(display_text_map=self.my_osid_object._my_map['texts']['fileName'])
Esempio n. 13
0
 def get_solution(self, parameters=None):
     """stub"""
     if not self.has_solution():
         raise IllegalState()
     return DisplayText(self.my_osid_object._my_map['solution'])
Esempio n. 14
0
 def test_initer_raises_null_argument(self):
     with pytest.raises(errors.NullArgument):
         DisplayText()