mirror of
https://gitea.com/actions/setup-python.git
synced 2026-03-17 21:48:43 +07:00
Add support to .tool-version file format
Create a function to parse tool-version (asdf-vm) format, add the associated tests, and updated the documentation Ticket-ID: #571
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import * as cache from '@actions/cache';
|
||||
import * as core from '@actions/core';
|
||||
import {
|
||||
parsePythonVersionFile,
|
||||
validateVersion,
|
||||
validatePythonVersionFormatForPyPy,
|
||||
isCacheFeatureAvailable
|
||||
@@ -9,6 +10,20 @@ import {
|
||||
jest.mock('@actions/cache');
|
||||
jest.mock('@actions/core');
|
||||
|
||||
describe('parsePythonVersionFile', () => {
|
||||
it('handle the content of a .python-version file', () => {
|
||||
expect(parsePythonVersionFile('3.6')).toEqual('3.6')
|
||||
});
|
||||
|
||||
it('trims extra spaces at the end of the content', () => {
|
||||
expect(parsePythonVersionFile('3.7 ')).toEqual('3.7')
|
||||
});
|
||||
|
||||
it('parses correctly the content of .tool-version files', () => {
|
||||
expect(parsePythonVersionFile('python 3.7')).toEqual('3.7')
|
||||
});
|
||||
});
|
||||
|
||||
describe('validatePythonVersionFormatForPyPy', () => {
|
||||
it.each([
|
||||
['3.6', true],
|
||||
|
||||
Reference in New Issue
Block a user