def test_comma_separated_callback(values, parsed_value, expected_value):
"""Assert our comma_separated_callback behaves the right way."""
dest = 'select'
opt_str = '--{}'.format(dest)
option = optparse.Option(opt_str, dest=dest)
parser = mock.Mock(values=optparse.Values(values))
options.comma_separated_callback(option, opt_str, parsed_value, parser)
assert getattr(parser.values, dest) == expected_value
# NOTE(sigmavirus24): Now for the tricky bits
# We can only really effectively test the composition with real integration
# tests.
# Testing generate_callback_from's composition separately means we don't need
# to test it when we test the register function. We can just assert it has a
# callback.
评论列表
文章目录