def test_render_options(): def eq(o1, o2): return set(o1.split()) == set(o2.split()) assert java_options('a', 'b', 'cow') == '-a -b -cow' assert eq(java_options({'a': None, 'b': None, 'cow': None}), '-a -b -cow') assert eq(java_options({ 'a': None, 'b': 1, 'cow': 'foo' }), '-a -b 1 -cow foo') assert eq(java_options(**{ 'a': None, 'b': 1, 'cow': 'foo' }), '-a -b 1 -cow foo') assert java_options('a', {'b': 1}, cow='foo') == '-a -b 1 -cow foo' assert python_options('a', 'b', 'cow') == '-a -b --cow' assert eq(python_options({ 'a': None, 'b': None, 'cow': None }), '-a -b --cow') assert eq(python_options({ 'a': None, 'b': 1, 'cow': 'foo' }), '-a -b 1 --cow foo') assert eq(python_options(**{ 'a': None, 'b': 1, 'cow': 'foo' }), '-a -b 1 --cow foo') assert python_options('a', {'b': 1}, cow='foo') == '-a -b 1 --cow foo'
def test_render_ordered(): od = OrderedDict() od['a'] = 1 od['b'] = 2 od['c'] = 3 assert java_options(od) == '-a 1 -b 2 -c 3' od = OrderedDict() od['c'] = 3 od['b'] = 2 od['a'] = 1 assert java_options(od) == '-c 3 -b 2 -a 1'
def test_render_options(): def eq(o1, o2): return set(o1.split()) == set(o2.split()) assert java_options('a', 'b', 'cow') == '-a -b -cow' assert eq(java_options({'a': None, 'b': None, 'cow': None}), '-a -b -cow') assert eq(java_options({'a': None, 'b': 1, 'cow': 'foo'}), '-a -b 1 -cow foo') assert eq(java_options(**{'a': None, 'b': 1, 'cow': 'foo'}), '-a -b 1 -cow foo') assert java_options('a', {'b': 1}, cow='foo') == '-a -b 1 -cow foo' assert python_options('a', 'b', 'cow') == '-a -b --cow' assert eq(python_options({'a': None, 'b': None, 'cow': None}), '-a -b --cow') assert eq(python_options({'a': None, 'b': 1, 'cow': 'foo'}), '-a -b 1 --cow foo') assert eq(python_options(**{'a': None, 'b': 1, 'cow': 'foo'}), '-a -b 1 --cow foo') assert python_options('a', {'b': 1}, cow='foo') == '-a -b 1 --cow foo'