core-lightning/contrib/pyln-client/tests/test_clnutils.py

44 lines
1,008 B
Python
Raw Normal View History

from pyln.client.clnutils import cln_parse_rpcversion
def test_rpcversion():
foo = cln_parse_rpcversion("0.11.2")
pyproject.toml: Update ancient flake8 v4.0 no longer works for me (see below, and widely reported elsewhere). v5.0 doesn't understand f strings, and creates a flood of complaints. v6.0 requires python >= 3.8.1, so we need to update that. v7.0 is the latest, but why push it. ``` make check-python-flake8 Traceback (most recent call last): File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/bin/flake8", line 8, in <module> sys.exit(main()) ^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/cli.py", line 22, in main app.run(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 375, in run self._run(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 363, in _run self.initialize(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 343, in initialize self.find_plugins(config_finder) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 157, in find_plugins self.check_plugins = plugin_manager.Checkers(local_plugins.extension) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 363, in __init__ self.manager = PluginManager( ^^^^^^^^^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 243, in __init__ self._load_entrypoint_plugins() File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 261, in _load_entrypoint_plugins eps = importlib_metadata.entry_points().get(self.namespace, ()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'EntryPoints' object has no attribute 'get' make: *** [Makefile:535: check-python-flake8] Error 1 ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-06-19 15:57:22 +09:30
assert foo[0] == 0
assert foo[1] == 11
assert foo[2] == 2
foo = cln_parse_rpcversion("0.11.2rc2-modded")
pyproject.toml: Update ancient flake8 v4.0 no longer works for me (see below, and widely reported elsewhere). v5.0 doesn't understand f strings, and creates a flood of complaints. v6.0 requires python >= 3.8.1, so we need to update that. v7.0 is the latest, but why push it. ``` make check-python-flake8 Traceback (most recent call last): File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/bin/flake8", line 8, in <module> sys.exit(main()) ^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/cli.py", line 22, in main app.run(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 375, in run self._run(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 363, in _run self.initialize(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 343, in initialize self.find_plugins(config_finder) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 157, in find_plugins self.check_plugins = plugin_manager.Checkers(local_plugins.extension) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 363, in __init__ self.manager = PluginManager( ^^^^^^^^^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 243, in __init__ self._load_entrypoint_plugins() File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 261, in _load_entrypoint_plugins eps = importlib_metadata.entry_points().get(self.namespace, ()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'EntryPoints' object has no attribute 'get' make: *** [Makefile:535: check-python-flake8] Error 1 ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-06-19 15:57:22 +09:30
assert foo[0] == 0
assert foo[1] == 11
assert foo[2] == 2
foo = cln_parse_rpcversion("22.11")
pyproject.toml: Update ancient flake8 v4.0 no longer works for me (see below, and widely reported elsewhere). v5.0 doesn't understand f strings, and creates a flood of complaints. v6.0 requires python >= 3.8.1, so we need to update that. v7.0 is the latest, but why push it. ``` make check-python-flake8 Traceback (most recent call last): File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/bin/flake8", line 8, in <module> sys.exit(main()) ^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/cli.py", line 22, in main app.run(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 375, in run self._run(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 363, in _run self.initialize(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 343, in initialize self.find_plugins(config_finder) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 157, in find_plugins self.check_plugins = plugin_manager.Checkers(local_plugins.extension) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 363, in __init__ self.manager = PluginManager( ^^^^^^^^^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 243, in __init__ self._load_entrypoint_plugins() File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 261, in _load_entrypoint_plugins eps = importlib_metadata.entry_points().get(self.namespace, ()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'EntryPoints' object has no attribute 'get' make: *** [Makefile:535: check-python-flake8] Error 1 ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-06-19 15:57:22 +09:30
assert foo[0] == 22
assert foo[1] == 11
assert foo[2] == 0
foo = cln_parse_rpcversion("22.11rc1")
pyproject.toml: Update ancient flake8 v4.0 no longer works for me (see below, and widely reported elsewhere). v5.0 doesn't understand f strings, and creates a flood of complaints. v6.0 requires python >= 3.8.1, so we need to update that. v7.0 is the latest, but why push it. ``` make check-python-flake8 Traceback (most recent call last): File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/bin/flake8", line 8, in <module> sys.exit(main()) ^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/cli.py", line 22, in main app.run(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 375, in run self._run(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 363, in _run self.initialize(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 343, in initialize self.find_plugins(config_finder) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 157, in find_plugins self.check_plugins = plugin_manager.Checkers(local_plugins.extension) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 363, in __init__ self.manager = PluginManager( ^^^^^^^^^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 243, in __init__ self._load_entrypoint_plugins() File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 261, in _load_entrypoint_plugins eps = importlib_metadata.entry_points().get(self.namespace, ()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'EntryPoints' object has no attribute 'get' make: *** [Makefile:535: check-python-flake8] Error 1 ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-06-19 15:57:22 +09:30
assert foo[0] == 22
assert foo[1] == 11
assert foo[2] == 0
foo = cln_parse_rpcversion("22.11rc1-modded")
pyproject.toml: Update ancient flake8 v4.0 no longer works for me (see below, and widely reported elsewhere). v5.0 doesn't understand f strings, and creates a flood of complaints. v6.0 requires python >= 3.8.1, so we need to update that. v7.0 is the latest, but why push it. ``` make check-python-flake8 Traceback (most recent call last): File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/bin/flake8", line 8, in <module> sys.exit(main()) ^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/cli.py", line 22, in main app.run(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 375, in run self._run(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 363, in _run self.initialize(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 343, in initialize self.find_plugins(config_finder) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 157, in find_plugins self.check_plugins = plugin_manager.Checkers(local_plugins.extension) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 363, in __init__ self.manager = PluginManager( ^^^^^^^^^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 243, in __init__ self._load_entrypoint_plugins() File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 261, in _load_entrypoint_plugins eps = importlib_metadata.entry_points().get(self.namespace, ()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'EntryPoints' object has no attribute 'get' make: *** [Makefile:535: check-python-flake8] Error 1 ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-06-19 15:57:22 +09:30
assert foo[0] == 22
assert foo[1] == 11
assert foo[2] == 0
foo = cln_parse_rpcversion("22.11-modded")
pyproject.toml: Update ancient flake8 v4.0 no longer works for me (see below, and widely reported elsewhere). v5.0 doesn't understand f strings, and creates a flood of complaints. v6.0 requires python >= 3.8.1, so we need to update that. v7.0 is the latest, but why push it. ``` make check-python-flake8 Traceback (most recent call last): File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/bin/flake8", line 8, in <module> sys.exit(main()) ^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/cli.py", line 22, in main app.run(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 375, in run self._run(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 363, in _run self.initialize(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 343, in initialize self.find_plugins(config_finder) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 157, in find_plugins self.check_plugins = plugin_manager.Checkers(local_plugins.extension) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 363, in __init__ self.manager = PluginManager( ^^^^^^^^^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 243, in __init__ self._load_entrypoint_plugins() File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 261, in _load_entrypoint_plugins eps = importlib_metadata.entry_points().get(self.namespace, ()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'EntryPoints' object has no attribute 'get' make: *** [Makefile:535: check-python-flake8] Error 1 ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-06-19 15:57:22 +09:30
assert foo[0] == 22
assert foo[1] == 11
assert foo[2] == 0
foo = cln_parse_rpcversion("22.11.0")
pyproject.toml: Update ancient flake8 v4.0 no longer works for me (see below, and widely reported elsewhere). v5.0 doesn't understand f strings, and creates a flood of complaints. v6.0 requires python >= 3.8.1, so we need to update that. v7.0 is the latest, but why push it. ``` make check-python-flake8 Traceback (most recent call last): File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/bin/flake8", line 8, in <module> sys.exit(main()) ^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/cli.py", line 22, in main app.run(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 375, in run self._run(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 363, in _run self.initialize(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 343, in initialize self.find_plugins(config_finder) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 157, in find_plugins self.check_plugins = plugin_manager.Checkers(local_plugins.extension) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 363, in __init__ self.manager = PluginManager( ^^^^^^^^^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 243, in __init__ self._load_entrypoint_plugins() File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 261, in _load_entrypoint_plugins eps = importlib_metadata.entry_points().get(self.namespace, ()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'EntryPoints' object has no attribute 'get' make: *** [Makefile:535: check-python-flake8] Error 1 ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-06-19 15:57:22 +09:30
assert foo[0] == 22
assert foo[1] == 11
assert foo[2] == 0
foo = cln_parse_rpcversion("22.11.1")
pyproject.toml: Update ancient flake8 v4.0 no longer works for me (see below, and widely reported elsewhere). v5.0 doesn't understand f strings, and creates a flood of complaints. v6.0 requires python >= 3.8.1, so we need to update that. v7.0 is the latest, but why push it. ``` make check-python-flake8 Traceback (most recent call last): File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/bin/flake8", line 8, in <module> sys.exit(main()) ^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/cli.py", line 22, in main app.run(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 375, in run self._run(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 363, in _run self.initialize(argv) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 343, in initialize self.find_plugins(config_finder) File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 157, in find_plugins self.check_plugins = plugin_manager.Checkers(local_plugins.extension) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 363, in __init__ self.manager = PluginManager( ^^^^^^^^^^^^^^ File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 243, in __init__ self._load_entrypoint_plugins() File "/home/rusty/.cache/pypoetry/virtualenvs/cln-meta-project-BgKQHyxC-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 261, in _load_entrypoint_plugins eps = importlib_metadata.entry_points().get(self.namespace, ()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'EntryPoints' object has no attribute 'get' make: *** [Makefile:535: check-python-flake8] Error 1 ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-06-19 15:57:22 +09:30
assert foo[0] == 22
assert foo[1] == 11
assert foo[2] == 1