File: shell_test.py

package info (click to toggle)
kiwi 10.2.36-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 7,664 kB
  • sloc: python: 69,179; sh: 4,228; xml: 3,383; ansic: 391; makefile: 353
file content (18 lines) | stat: -rw-r--r-- 781 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from pytest import raises

from kiwi.system.shell import Shell
from kiwi.exceptions import KiwiShellVariableValueError


class TestSystemShell:
    def test_format_to_variable_value(self):
        assert Shell.format_to_variable_value('text') == 'text'
        assert Shell.format_to_variable_value(True) == 'true'
        assert Shell.format_to_variable_value(False) == 'false'
        assert Shell.format_to_variable_value('42') == '42'
        assert Shell.format_to_variable_value(0) == '0'
        assert Shell.format_to_variable_value(42) == '42'
        assert Shell.format_to_variable_value(None) == ''
        assert Shell.format_to_variable_value(b"42") == '42'
        with raises(KiwiShellVariableValueError):
            Shell.format_to_variable_value(['foo', 'bar'])