示例#1
0
    def test_arrayreader_ends_with_comma(self, prompt_mock):
        spec = {"description": "some description", "default": ["a", "b"]}
        Reader = interactive.ArrayReader("some", spec)

        prompt_mock.return_value = "some,thing,else,"
        result = Reader.read()

        self.assertEqual(result, ["some", "thing", "else", ""])
        self.assertPromptMessage(prompt_mock, "some (comma-separated list) [a,b]: ")
        self.assertPromptDescription(prompt_mock, "some description")
        self.assertPromptValidate(prompt_mock, "some,thing,else,")
示例#2
0
    def test_arrayreader_ends_with_comma(self, prompt_mock):
        spec = {'description': 'some description', 'default': ['a', 'b']}
        Reader = interactive.ArrayReader('some', spec)

        prompt_mock.return_value = 'some,thing,else,'
        result = Reader.read()

        self.assertEqual(result, ['some', 'thing', 'else', ''])
        self.assertPromptMessage(prompt_mock,
                                 'some (comma-separated list) [a,b]: ')
        self.assertPromptDescription(prompt_mock, 'some description')
        self.assertPromptValidate(prompt_mock, 'some,thing,else,')