mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-16 00:14:57 +00:00
Add pip package alias resolutions for commonly-misnamed or distribution-variant packages. psycopg2 shipped as sdist-only on PyPI (requires pg_config); aliases to psycopg2-binary. Other entries handle distribution variants (MySQLdb→mysqlclient, Crypto→pycryptodome, etc).
40 lines
955 B
Go
40 lines
955 B
Go
package skills
|
|
|
|
import "testing"
|
|
|
|
func TestImportToPipName(t *testing.T) {
|
|
cases := []struct {
|
|
importName string
|
|
want string
|
|
}{
|
|
{"cv2", "opencv-python"},
|
|
{"PIL", "Pillow"},
|
|
{"yaml", "pyyaml"},
|
|
{"sklearn", "scikit-learn"},
|
|
{"bs4", "beautifulsoup4"},
|
|
{"dateutil", "python-dateutil"},
|
|
{"dotenv", "python-dotenv"},
|
|
{"pptx", "python-pptx"},
|
|
{"docx", "python-docx"},
|
|
{"attr", "attrs"},
|
|
{"gi", "PyGObject"},
|
|
{"psycopg2", "psycopg2-binary"},
|
|
{"psycopg", "psycopg[binary]"},
|
|
{"MySQLdb", "mysqlclient"},
|
|
{"Crypto", "pycryptodome"},
|
|
{"serial", "pyserial"},
|
|
{"skimage", "scikit-image"},
|
|
{"Levenshtein", "python-Levenshtein"},
|
|
{"requests", "requests"},
|
|
{"numpy", "numpy"},
|
|
{"", ""},
|
|
}
|
|
for _, tc := range cases {
|
|
t.Run(tc.importName, func(t *testing.T) {
|
|
if got := importToPipName(tc.importName); got != tc.want {
|
|
t.Errorf("importToPipName(%q) = %q, want %q", tc.importName, got, tc.want)
|
|
}
|
|
})
|
|
}
|
|
}
|