Exemplo n.º 1
0
    def test_arg_too_long(self):
        valerr = None  # type: Optional[ValueError]
        try:
            _ = spurplus.chunk_arguments(args=['some-arg'], arg_max=3)
        except ValueError as err:
            valerr = err

        self.assertEqual(
            "The command-line argument 0 is longer than allowed maximum length 3: some-arg",
            str(valerr))
Exemplo n.º 2
0
 def test_chunk_with_multiple_args(self):
     self.assertListEqual([['some-arg', 'other-arg'], ['yet-another-arg']],
                          spurplus.chunk_arguments(args=[
                              'some-arg', 'other-arg', 'yet-another-arg'
                          ],
                                                   arg_max=20))
Exemplo n.º 3
0
 def test_no_split(self):
     self.assertListEqual([['some-arg', 'other-arg']],
                          spurplus.chunk_arguments(
                              args=['some-arg', 'other-arg'],
                              arg_max=16 * 1024,
                              argc_max=1024))
Exemplo n.º 4
0
 def test_small_argc_max(self):
     self.assertListEqual([['some-arg'], ['other-arg']],
                          spurplus.chunk_arguments(
                              args=['some-arg', 'other-arg'], argc_max=1))
Exemplo n.º 5
0
 def test_single(self):
     self.assertListEqual([['some-arg']],
                          spurplus.chunk_arguments(args=['some-arg']))
Exemplo n.º 6
0
 def test_empty(self):
     self.assertListEqual([], spurplus.chunk_arguments(args=[]))