| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,6 +28,7 @@ See [Mixins/collections.py](src/runtime/Mixins/collections.py). | |||
| 28 | 28 | and other `PyObject` derived types when called from Python. | |
| 29 | 29 | - .NET classes, that have `__call__` method are callable from Python | |
| 30 | 30 | - `PyIterable` type, that wraps any iterable object in Python | |
| 31 | + - `PythonEngine` properties for supported Python versions: `MinSupportedVersion`, `MaxSupportedVersion`, and `IsSupportedVersion` | ||
| 31 | 32 | ||
| 32 | 33 | ||
| 33 | 34 | ### Changed | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -127,6 +127,10 @@ public static string PythonPath | |||
| 127 | 127 | } | |
| 128 | 128 | } | |
| 129 | 129 | ||
| 130 | + public static Version MinSupportedVersion => new(3, 7); | ||
| 131 | + public static Version MaxSupportedVersion => new(3, 10, int.MaxValue, int.MaxValue); | ||
| 132 | + public static bool IsSupportedVersion(Version version) => version >= MinSupportedVersion && version <= MaxSupportedVersion; | ||
| 133 | + | ||
| 130 | 134 | public static string Version | |
| 131 | 135 | { | |
| 132 | 136 | get { return Marshal.PtrToStringAnsi(Runtime.Py_GetVersion()); } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,6 +19,14 @@ def test_multiple_calls_to_initialize(): | |||
| 19 | 19 | assert False # Initialize() raise an exception. | |
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | + def test_supported_version(): | ||
| 23 | + major, minor, build, *_ = sys.version_info | ||
| 24 | + ver = System.Version(major, minor, build) | ||
| 25 | + assert PythonEngine.IsSupportedVersion(ver) | ||
| 26 | + assert ver >= PythonEngine.MinSupportedVersion | ||
| 27 | + assert ver <= PythonEngine.MaxSupportedVersion | ||
| 28 | + | ||
| 29 | + | ||
| 22 | 30 | @pytest.mark.skip(reason="FIXME: test crashes") | |
| 23 | 31 | def test_import_module(): | |
| 24 | 32 | """Test module import.""" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments