Python absl.flags.DEFINE_spaceseplist() Examples

The following are 2 code examples of absl.flags.DEFINE_spaceseplist(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module absl.flags , or try the search function .
Example #1
Source File: flags_helpxml_test.py    From abseil-py with Apache License 2.0 6 votes vote down vote up
def test_flag_help_in_xml_space_separated_list(self):
    flags.DEFINE_spaceseplist('dirs', 'src libs bin',
                              'Directories to search.', flag_values=self.fv)
    expected_separators = sorted(string.whitespace)
    expected_output = (
        '<flag>\n'
        '  <file>tool</file>\n'
        '  <name>dirs</name>\n'
        '  <meaning>Directories to search.</meaning>\n'
        '  <default>src libs bin</default>\n'
        '  <current>[\'src\', \'libs\', \'bin\']</current>\n'
        '  <type>whitespace separated list of strings</type>\n'
        'LIST_SEPARATORS'
        '</flag>\n').replace('LIST_SEPARATORS',
                             _list_separators_in_xmlformat(expected_separators,
                                                           indent='  '))
    self._check_flag_help_in_xml('dirs', 'tool', expected_output) 
Example #2
Source File: flags_helpxml_test.py    From abseil-py with Apache License 2.0 6 votes vote down vote up
def test_flag_help_in_xml_space_separated_list_with_comma_compat(self):
    flags.DEFINE_spaceseplist('dirs', 'src libs,bin',
                              'Directories to search.', comma_compat=True,
                              flag_values=self.fv)
    expected_separators = sorted(string.whitespace + ',')
    expected_output = (
        '<flag>\n'
        '  <file>tool</file>\n'
        '  <name>dirs</name>\n'
        '  <meaning>Directories to search.</meaning>\n'
        '  <default>src libs bin</default>\n'
        '  <current>[\'src\', \'libs\', \'bin\']</current>\n'
        '  <type>whitespace or comma separated list of strings</type>\n'
        'LIST_SEPARATORS'
        '</flag>\n').replace('LIST_SEPARATORS',
                             _list_separators_in_xmlformat(expected_separators,
                                                           indent='  '))
    self._check_flag_help_in_xml('dirs', 'tool', expected_output)