Collection of features present in newer Python versions (v2.x, v3.x) backported to legacy Python versions (tested down to v2.1).
Supported Python implementation:
This package provides backporting for the following features:
pathlib.Path()class (Python>=3.4)bool()class (Python>=2.3) as well asTrueandFalse(Python>=2.3)dict()classsorted()function (Python>=2.4)sum()function (Python>=2.3)collections.OrderedDict()(Python>=2.7)jsonmodule (Python>=2.6)loggingmodule (Python>=2.3)itertoolsmodule (Python>=2.3)set()class (setsmodulePython>=2.3, standard libraryPython>=2.4)print()function (keyword arguments such asendorsepwere added inPython 3.3, see module docstring for more details)
After performing a change to a module it's best practice to always run tests and update those failing (or add some if it's a new feature).
To run all the tests in this repository use the following command:
poetry run python -m unittest discover ./src/You can test single files using the following commands:
When developing using poetry use the following command:
poetry run python /path/to/module.pyFor example:
(polyfills-py3.9) → ~\polyfills › poetry run python .\src\polyfills\pathlib\__init__.py
..........
----------------------------------------------------------------------
Ran 10 tests in 0.004s
OKTo run tests on a host running the Websphere Application Server Jython console (wsadmin.sh) run the following command:
/path/to/profile/bin/wsadmin.sh -lang jython -f /path/to/module.pyFor example:
username@hostname ~ $ /opt/Websphere/MyCell/profiles/dmgr/bin/wsadmin.sh -lang jython -f /src/polyfills/pathlib/__init__.py
WASX7209I: Connected to process "dmgr" on node MyNode using SOAP connector; The type of process is: DeploymentManager
..........
----------------------------------------------------------------------
Ran 10 tests in 0.068s
OK