|
13 | 13 | # limitations under the License.
|
14 | 14 |
|
15 | 15 | import inspect
|
| 16 | +import sys |
16 | 17 | from unittest.mock import patch
|
17 | 18 |
|
18 | 19 | import bigframes_vendored.constants as constants
|
@@ -227,6 +228,28 @@ def test_get_updated_package_requirements_with_existing_cloudpickle():
|
227 | 228 | assert result == expected
|
228 | 229 |
|
229 | 230 |
|
| 231 | +# Dynamically generate expected python versions for the test |
| 232 | +_major = sys.version_info.major |
| 233 | +_minor = sys.version_info.minor |
| 234 | +_compat_version = f"python{_major}{_minor}" |
| 235 | +_standard_version = f"python-{_major}.{_minor}" |
| 236 | + |
| 237 | + |
| 238 | +@pytest.mark.parametrize( |
| 239 | + "is_compat, expected_version", |
| 240 | + [ |
| 241 | + (True, _compat_version), |
| 242 | + (False, _standard_version), |
| 243 | + ], |
| 244 | +) |
| 245 | +def test_get_python_version(is_compat, expected_version): |
| 246 | + """ |
| 247 | + Tests the python version string formatting for both standard and compat modes. |
| 248 | + """ |
| 249 | + result = _utils.get_python_version(is_compat=is_compat) |
| 250 | + assert result == expected_version |
| 251 | + |
| 252 | + |
230 | 253 | def test_package_existed_helper():
|
231 | 254 | """Tests the _package_existed helper function directly."""
|
232 | 255 | reqs = ["pandas==1.0", "numpy", "scikit-learn>=1.2.0"]
|
|
0 commit comments