diff options
author | 2017-03-29 13:35:45 +0300 | |
---|---|---|
committer | 2017-03-29 13:35:45 +0300 | |
commit | e2cc2530fc6d54ebc975c01a4ff887ce12f0a736 (patch) | |
tree | 38385867295c8a09fb0d7f8eaf5fa78179e5b13a /jython-tosca-parser/src/main/resources/Lib/site-packages/setuptools/tests/test_markerlib.py | |
parent | bccebaa9888906f8ff78172f62ec592956066d82 (diff) |
[SDC-6] sdc-distribution-client 1707 rebasing
Change-Id: I322a05fd79beb6ba4fee4d32afffecf531b86e98
Signed-off-by: Pavel Aharoni <pa0916@att.com>
Diffstat (limited to 'jython-tosca-parser/src/main/resources/Lib/site-packages/setuptools/tests/test_markerlib.py')
-rw-r--r-- | jython-tosca-parser/src/main/resources/Lib/site-packages/setuptools/tests/test_markerlib.py | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/setuptools/tests/test_markerlib.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/setuptools/tests/test_markerlib.py new file mode 100644 index 0000000..8197b49 --- /dev/null +++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/setuptools/tests/test_markerlib.py @@ -0,0 +1,63 @@ +import os + +import pytest + + +class TestMarkerlib: + + @pytest.mark.importorskip('ast') + def test_markers(self): + from _markerlib import interpret, default_environment, compile + + os_name = os.name + + assert interpret("") + + assert interpret("os.name != 'buuuu'") + assert interpret("os_name != 'buuuu'") + assert interpret("python_version > '1.0'") + assert interpret("python_version < '5.0'") + assert interpret("python_version <= '5.0'") + assert interpret("python_version >= '1.0'") + assert interpret("'%s' in os.name" % os_name) + assert interpret("'%s' in os_name" % os_name) + assert interpret("'buuuu' not in os.name") + + assert not interpret("os.name == 'buuuu'") + assert not interpret("os_name == 'buuuu'") + assert not interpret("python_version < '1.0'") + assert not interpret("python_version > '5.0'") + assert not interpret("python_version >= '5.0'") + assert not interpret("python_version <= '1.0'") + assert not interpret("'%s' not in os.name" % os_name) + assert not interpret("'buuuu' in os.name and python_version >= '5.0'") + assert not interpret("'buuuu' in os_name and python_version >= '5.0'") + + environment = default_environment() + environment['extra'] = 'test' + assert interpret("extra == 'test'", environment) + assert not interpret("extra == 'doc'", environment) + + def raises_nameError(): + try: + interpret("python.version == '42'") + except NameError: + pass + else: + raise Exception("Expected NameError") + + raises_nameError() + + def raises_syntaxError(): + try: + interpret("(x for x in (4,))") + except SyntaxError: + pass + else: + raise Exception("Expected SyntaxError") + + raises_syntaxError() + + statement = "python_version == '5'" + assert compile(statement).__doc__ == statement + |