Пример #1
0
def _DescriptionSection(component, info):
  """The "Description" sections of the help string.

  Args:
    component: The component to produce the description section for.
    info: The info dict for the component of interest.

  Returns:
    Returns the description if available. If not, returns the summary.
    If neither are available, returns None.
  """
  if custom_descriptions.NeedsCustomDescription(component):
    available_space = LINE_LENGTH - SECTION_INDENTATION
    description = custom_descriptions.GetDescription(component, available_space,
                                                     LINE_LENGTH)
    summary = custom_descriptions.GetSummary(component, available_space,
                                             LINE_LENGTH)
  else:
    description = _GetDescription(info)
    summary = _GetSummary(info)
  # Fall back to summary if description is not available.
  text = description or summary or None
  if text:
    return ('DESCRIPTION', text)
  else:
    return None
Пример #2
0
 def test_string_type_description_not_enough_space_new_line(self):
   component = 'Lorem ipsum dolor sit amet'
   description = custom_descriptions.GetDescription(
       obj=component, available_space=10, line_length=LINE_LENGTH)
   self.assertEqual(description, 'The string "Lorem ipsum dolor sit amet"')
Пример #3
0
 def test_string_type_description_enough_space(self):
   component = 'Test'
   description = custom_descriptions.GetDescription(
       obj=component, available_space=80, line_length=LINE_LENGTH)
   self.assertEqual(description, 'The string "Test"')