-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathpython.test.ts
More file actions
47 lines (38 loc) · 1.61 KB
/
python.test.ts
File metadata and controls
47 lines (38 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import type { PythonRuntime } from '../../../schema/index.js';
import { PLATFORM_CANDIDATES, extractPythonVersion } from '../python.js';
import { describe, expect, it } from 'vitest';
describe('extractPythonVersion', () => {
it('extracts 3.10 from PYTHON_3_10', () => {
expect(extractPythonVersion('PYTHON_3_10' as PythonRuntime)).toBe('3.10');
});
it('extracts 3.11 from PYTHON_3_11', () => {
expect(extractPythonVersion('PYTHON_3_11' as PythonRuntime)).toBe('3.11');
});
it('extracts 3.12 from PYTHON_3_12', () => {
expect(extractPythonVersion('PYTHON_3_12' as PythonRuntime)).toBe('3.12');
});
it('extracts 3.13 from PYTHON_3_13', () => {
expect(extractPythonVersion('PYTHON_3_13' as PythonRuntime)).toBe('3.13');
});
it('extracts 3.14 from PYTHON_3_14', () => {
expect(extractPythonVersion('PYTHON_3_14' as PythonRuntime)).toBe('3.14');
});
it('throws for unsupported runtime string', () => {
expect(() => extractPythonVersion('RUBY_3_0' as PythonRuntime)).toThrow('Unsupported Python runtime');
});
it('throws for malformed runtime (missing minor)', () => {
expect(() => extractPythonVersion('PYTHON_3' as PythonRuntime)).toThrow('Invalid Python runtime');
});
});
describe('PLATFORM_CANDIDATES', () => {
it('contains aarch64 manylinux platforms', () => {
expect(PLATFORM_CANDIDATES).toHaveLength(3);
for (const p of PLATFORM_CANDIDATES) {
expect(p).toContain('aarch64');
expect(p).toContain('manylinux');
}
});
it('includes manylinux2014 as first candidate', () => {
expect(PLATFORM_CANDIDATES[0]).toBe('aarch64-manylinux2014');
});
});