Debian Codegraph @

test/unit/system/shell_test.py

raw
1 from pytest import raises
2
3 from kiwi.system.shell import Shell
4 from kiwi.exceptions import KiwiShellVariableValueError
5
6
7 class TestSystemShell:
8 def test_format_to_variable_value(self):
9 assert Shell.format_to_variable_value('text') == 'text'
10 assert Shell.format_to_variable_value(True) == 'true'
11 assert Shell.format_to_variable_value(False) == 'false'
12 assert Shell.format_to_variable_value('42') == '42'
13 assert Shell.format_to_variable_value(0) == '0'
14 assert Shell.format_to_variable_value(42) == '42'
15 assert Shell.format_to_variable_value(None) == ''
16 assert Shell.format_to_variable_value(b"42") == '42'
17 with raises(KiwiShellVariableValueError):
18 Shell.format_to_variable_value(['foo', 'bar'])