feat: Add comprehensive test cases for wheel filename parsing

This commit is contained in:
Denis Bilenko (aider) 2025-03-04 17:41:14 +01:00 committed by Denis Bilenko
parent 95a64fd3cb
commit 3135f4e38f
1 changed files with 155 additions and 0 deletions

View File

@ -360,6 +360,161 @@ func TestParseWheelFilename(t *testing.T) {
wantTags: []string{"py3", "none", "any"},
wantErr: false,
},
// Test cases from the AI TODO
{
filename: "astrocats-0.3.2-universal-none-any.whl",
wantDistribution: "astrocats",
wantVersion: "0.3.2",
wantTags: []string{"universal", "none", "any"},
wantErr: false,
},
{
filename: "bencoder.pyx-1.1.2-pp226-pp226-win32.whl",
wantDistribution: "bencoder.pyx",
wantVersion: "1.1.2",
wantTags: []string{"pp226", "pp226", "win32"},
wantErr: false,
},
{
filename: "brotlipy-0.1.2-pp27-none-macosx_10_10_x86_64.whl",
wantDistribution: "brotlipy",
wantVersion: "0.1.2",
wantTags: []string{"pp27", "none", "macosx_10_10_x86_64"},
wantErr: false,
},
{
filename: "brotlipy-0.3.0-pp226-pp226u-macosx_10_10_x86_64.whl",
wantDistribution: "brotlipy",
wantVersion: "0.3.0",
wantTags: []string{"pp226", "pp226u", "macosx_10_10_x86_64"},
wantErr: false,
},
{
filename: "carbonara_archinfo-7.7.9.14.post1-py2-none-any.whl",
wantDistribution: "carbonara_archinfo",
wantVersion: "7.7.9.14.post1",
wantTags: []string{"py2", "none", "any"},
wantErr: false,
},
{
filename: "coremltools-0.3.0-py2.7-none-any.whl",
wantDistribution: "coremltools",
wantVersion: "0.3.0",
wantTags: []string{"py2.7", "none", "any"},
wantErr: false,
},
{
filename: "cvxopt-1.2.0-001-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl",
wantDistribution: "cvxopt",
wantVersion: "1.2.0",
wantTags: []string{"001", "cp34", "cp34m", "macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64"},
wantErr: false,
},
{
filename: "django_mbrowse-0.0.1-10-py2-none-any.whl",
wantDistribution: "django_mbrowse",
wantVersion: "0.0.1",
wantTags: []string{"10", "py2", "none", "any"},
wantErr: false,
},
{
filename: "efilter-1!1.2-py2-none-any.whl",
wantDistribution: "efilter",
wantVersion: "1!1.2",
wantTags: []string{"py2", "none", "any"},
wantErr: false,
},
{
filename: "line.sep-0.2.0.dev1-py2.py3-none-any.whl",
wantDistribution: "line.sep",
wantVersion: "0.2.0.dev1",
wantTags: []string{"py2.py3", "none", "any"},
wantErr: false,
},
{
filename: "mayan_edms-1.1.0-1502100955-py2-none-any.whl",
wantDistribution: "mayan_edms",
wantVersion: "1.1.0",
wantTags: []string{"1502100955", "py2", "none", "any"},
wantErr: false,
},
{
filename: "mxnet_model_server-1.0a5-20180816-py2.py3-none-any.whl",
wantDistribution: "mxnet_model_server",
wantVersion: "1.0a5",
wantTags: []string{"20180816", "py2.py3", "none", "any"},
wantErr: false,
},
{
filename: "pip-18.0-py2.py3-none-any.whl",
wantDistribution: "pip",
wantVersion: "18.0",
wantTags: []string{"py2.py3", "none", "any"},
wantErr: false,
},
{
filename: "polarTransform-2-1.0.0-py3-none-any.whl",
wantDistribution: "polarTransform",
wantVersion: "2",
wantTags: []string{"1.0.0", "py3", "none", "any"},
wantErr: false,
},
{
filename: "psycopg2-2.7.5-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl",
wantDistribution: "psycopg2",
wantVersion: "2.7.5",
wantTags: []string{"cp37", "cp37m", "macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64"},
wantErr: false,
},
{
filename: "pyinterval-1.0.0-0-cp27-none-win32.whl",
wantDistribution: "pyinterval",
wantVersion: "1.0.0",
wantTags: []string{"0", "cp27", "none", "win32"},
wantErr: false,
},
{
filename: "pypi_simple-0.1.0.dev1-py2.py3-none-any.whl",
wantDistribution: "pypi_simple",
wantVersion: "0.1.0.dev1",
wantTags: []string{"py2.py3", "none", "any"},
wantErr: false,
},
{
filename: "PyQt3D-5.7.1-5.7.1-cp34.cp35.cp36-abi3-macosx_10_6_intel.whl",
wantDistribution: "PyQt3D",
wantVersion: "5.7.1",
wantTags: []string{"5.7.1", "cp34.cp35.cp36", "abi3", "macosx_10_6_intel"},
wantErr: false,
},
{
filename: "qypi-0.4.1-py3-none-any.whl",
wantDistribution: "qypi",
wantVersion: "0.4.1",
wantTags: []string{"py3", "none", "any"},
wantErr: false,
},
{
filename: "SimpleSteem-1.1.9-3.0-none-any.whl",
wantDistribution: "SimpleSteem",
wantVersion: "1.1.9",
wantTags: []string{"3.0", "none", "any"},
wantErr: false,
},
{
filename: "simple_workflow-0.1.47-pypy-none-any.whl",
wantDistribution: "simple_workflow",
wantVersion: "0.1.47",
wantTags: []string{"pypy", "none", "any"},
wantErr: false,
},
{
filename: "tables-3.4.2-3-cp27-cp27m-manylinux1_i686.whl",
wantDistribution: "tables",
wantVersion: "3.4.2",
wantTags: []string{"3", "cp27", "cp27m", "manylinux1_i686"},
wantErr: false,
},
{
filename: "invalid-filename.txt",
wantDistribution: "",