Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-url-normalize for
openSUSE:Factory checked in at 2025-09-29 20:43:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-url-normalize (Old)
and /work/SRC/openSUSE:Factory/.python-url-normalize.new.11973 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-url-normalize"
Mon Sep 29 20:43:33 2025 rev:4 rq:1307878 version:2.2.1
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-url-normalize/python-url-normalize.changes
2025-04-11 16:49:39.586490785 +0200
+++
/work/SRC/openSUSE:Factory/.python-url-normalize.new.11973/python-url-normalize.changes
2025-09-29 20:43:35.679672093 +0200
@@ -1,0 +2,7 @@
+Mon Sep 29 12:34:23 UTC 2025 - John Paul Adrian Glaubitz
<[email protected]>
+
+- Update to 2.2.1
+ * Include `py.typed` marker file for PEP 561 compatibility.
+- Use Python 3.11 on SLE-15 by default
+
+-------------------------------------------------------------------
Old:
----
url-normalize-2.2.0.tar.gz
New:
----
url-normalize-2.2.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-url-normalize.spec ++++++
--- /var/tmp/diff_new_pack.J5OduG/_old 2025-09-29 20:43:36.303698264 +0200
+++ /var/tmp/diff_new_pack.J5OduG/_new 2025-09-29 20:43:36.303698264 +0200
@@ -15,9 +15,9 @@
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
-
+%{?sle15_python_module_pythons}
Name: python-url-normalize
-Version: 2.2.0
+Version: 2.2.1
Release: 0
Summary: URL normalization for Python
License: MIT
++++++ url-normalize-2.2.0.tar.gz -> url-normalize-2.2.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/url-normalize-2.2.0/.github/workflows/ci.yml
new/url-normalize-2.2.1/.github/workflows/ci.yml
--- old/url-normalize-2.2.0/.github/workflows/ci.yml 2025-03-31
05:53:45.000000000 +0200
+++ new/url-normalize-2.2.1/.github/workflows/ci.yml 2025-04-26
19:40:26.000000000 +0200
@@ -1,42 +1,103 @@
-name: CI
+name: tests
on:
push:
- branches: [ master ]
+ # Avoid using all the resources/limits available by checking only
+ # relevant branches and tags. Other branches can be checked via PRs.
+ branches: [master]
+ tags: ['v[0-9]*', '[0-9]+.[0-9]+*'] # Match tags that resemble a version
pull_request:
- branches: [ master ]
+ workflow_dispatch: # Allow manually triggering the workflow
+ schedule:
+ # Run roughly every 15 days at 00:00 UTC
+ # (useful to check if updates on dependencies break the package)
+ - cron: '0 0 1,16 * *'
+
+concurrency:
+ group: >-
+ ${{ github.workflow }}-${{ github.ref_type }}-
+ ${{ github.event.pull_request.number || github.sha }}
+ cancel-in-progress: true
jobs:
- test:
+ prepare:
runs-on: ubuntu-latest
+ outputs:
+ wheel-distribution: ${{ steps.wheel-distribution.outputs.path }}
+ steps:
+ - uses: actions/checkout@v4
+ with: {fetch-depth: 0} # deep clone for setuptools-scm
+ - uses: actions/setup-python@v5
+ with: {python-version-file: "pyproject.toml"}
+ - uses: astral-sh/setup-uv@v5
+ - name: Run static analysis and format checkers
+ run: uv run --with '.[dev]' pre-commit run --all-files
+ - name: Build package distribution files
+ run: uv build
+ - name: Record the path of wheel distribution
+ id: wheel-distribution
+ run: echo "path=$(ls dist/*.whl)" >> $GITHUB_OUTPUT
+ - name: Store the distribution files for use in other stages
+ uses: actions/upload-artifact@v4
+ with:
+ name: python-distribution-files
+ path: dist/
+ retention-days: 1
+
+ test:
+ needs: prepare
strategy:
matrix:
- python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
+ python:
+ - "3.8" # oldest Python supported by validate-pyproject
+ - "3.x" # newest Python that is stable
+ platform:
+ - ubuntu-latest
+ - macos-13
+ - windows-latest
+ runs-on: ${{ matrix.platform }}
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-python@v5
+ with:
+ python-version: ${{ matrix.python }}
+ - uses: astral-sh/setup-uv@v5
+ - name: Retrieve pre-built distribution files
+ uses: actions/download-artifact@v4
+ with: {name: python-distribution-files, path: dist/}
+ - name: Run tests
+ run: uv run --with '.[dev]' pytest --cov-report=lcov:coverage.lcov
+ - name: Upload partial coverage report
+ uses: coverallsapp/github-action@v2
+ with:
+ path-to-lcov: coverage.lcov
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ flag-name: ${{ matrix.platform }} - py${{ matrix.python }}
+ parallel: true
+ finalize:
+ needs: test
+ runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
- - name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v5
- with:
- python-version: ${{ matrix.python-version }}
- - name: Install dependencies
- run: |
- python -m pip install --upgrade pip
- pip install tox tox-gh-actions
- - name: Test with tox
- run: tox
+ - name: Finalize coverage report
+ uses: coverallsapp/github-action@v2
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ parallel-finished: true
- lint:
+ publish:
+ needs: finalize
+ if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/')
}}
runs-on: ubuntu-latest
+ permissions:
+ id-token: write
steps:
- - uses: actions/checkout@v4
- - name: Set up Python
- uses: actions/setup-python@v5
- with:
- python-version: "3.12"
- - name: Install pre-commit
- run: |
- python -m pip install --upgrade pip
- pip install pre-commit
- - name: Run pre-commit
- run: pre-commit run --all-files
+ - uses: actions/checkout@v4
+ - uses: actions/setup-python@v5
+ with: {python-version-file: "pyproject.toml"}
+ - uses: astral-sh/setup-uv@v5
+ - name: Retrieve pre-built distribution files
+ uses: actions/download-artifact@v4
+ with: {name: python-distribution-files, path: dist/}
+ - name: Publish Package to PyPI
+ run: uv publish dist/*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/url-normalize-2.2.0/.github/workflows/publish.yml
new/url-normalize-2.2.1/.github/workflows/publish.yml
--- old/url-normalize-2.2.0/.github/workflows/publish.yml 2025-03-31
05:53:45.000000000 +0200
+++ new/url-normalize-2.2.1/.github/workflows/publish.yml 1970-01-01
01:00:00.000000000 +0100
@@ -1,30 +0,0 @@
-# This workflow publishes the package to PyPI when a release tag is pushed
-
-name: PyPI
-
-on:
- push:
- tags:
- - 'v*.*.*' # Trigger on version tags like v1.0.0
-
-permissions:
- contents: read
-
-jobs:
- deploy:
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@v4
-
- - name: Install uv
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
-
- - name: Build package
- run: uv build --out dist/
-
- - name: Publish package
- env:
- UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
- run: uv publish --user __token__ dist/*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/url-normalize-2.2.0/.gitignore
new/url-normalize-2.2.1/.gitignore
--- old/url-normalize-2.2.0/.gitignore 2025-03-31 05:53:45.000000000 +0200
+++ new/url-normalize-2.2.1/.gitignore 2025-04-26 19:40:26.000000000 +0200
@@ -1,9 +1,9 @@
__pycache__
.*
+!.coveragerc
!.github
!.pre-commit-config.yaml
*.egg-info
-*.lock
*.pyc
+build
dist
-memory-bank
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/url-normalize-2.2.0/.pre-commit-config.yaml
new/url-normalize-2.2.1/.pre-commit-config.yaml
--- old/url-normalize-2.2.0/.pre-commit-config.yaml 2025-03-31
05:53:45.000000000 +0200
+++ new/url-normalize-2.2.1/.pre-commit-config.yaml 2025-04-26
19:40:26.000000000 +0200
@@ -1,9 +1,25 @@
repos:
- - repo: https://github.com/astral-sh/ruff-pre-commit
- rev: v0.11.2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v5.0.0
hooks:
- - id: ruff
- args: [--fix]
+ - id: check-added-large-files
+ - id: check-ast
+ - id: check-json
+ - id: check-merge-conflict
+ - id: check-symlinks
+ - id: check-toml
+ - id: check-xml
+ - id: check-yaml
+ - id: debug-statements
+ - id: end-of-file-fixer
+ - id: requirements-txt-fixer
+ - id: trailing-whitespace
+ - id: mixed-line-ending
+ args: ["--fix=auto"] # replace 'auto' with 'lf' to enforce Linux/Mac
line endings or 'crlf' for Windows
+ - repo: https://github.com/abravalheri/validate-pyproject
+ rev: v0.24.1
+ hooks:
+ - id: validate-pyproject
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.15.0
hooks:
@@ -18,3 +34,9 @@
rev: v2.4.1
hooks:
- id: codespell
+ - repo: https://github.com/astral-sh/ruff-pre-commit
+ rev: v0.11.4
+ hooks:
+ - id: ruff-format
+ - id: ruff
+ args: [--fix, --exit-non-zero-on-fix]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/url-normalize-2.2.0/CHANGELOG.md
new/url-normalize-2.2.1/CHANGELOG.md
--- old/url-normalize-2.2.0/CHANGELOG.md 2025-03-31 05:53:45.000000000
+0200
+++ new/url-normalize-2.2.1/CHANGELOG.md 2025-04-26 19:40:26.000000000
+0200
@@ -5,6 +5,12 @@
The format is based on [Keep a
Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic
Versioning](https://semver.org/spec/v2.0.0.html).
+## [2.2.1] - 2025-04-26
+
+### Added
+
+- Include `py.typed` marker file for PEP 561 compatibility.
+
## [2.2.0] - 2025-03-30
### Added
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/url-normalize-2.2.0/Makefile
new/url-normalize-2.2.1/Makefile
--- old/url-normalize-2.2.0/Makefile 2025-03-31 05:53:45.000000000 +0200
+++ new/url-normalize-2.2.1/Makefile 2025-04-26 19:40:26.000000000 +0200
@@ -1,8 +1,7 @@
install:
@uv pip install -e ".[dev]"
-tox:
- @uvx --with tox-uv tox
+# tox target removed
update: install
@uv run -- pre-commit autoupdate
@@ -19,4 +18,3 @@
publish: build
@uv publish
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/url-normalize-2.2.0/README.md
new/url-normalize-2.2.1/README.md
--- old/url-normalize-2.2.0/README.md 2025-03-31 05:53:45.000000000 +0200
+++ new/url-normalize-2.2.1/README.md 2025-04-26 19:40:26.000000000 +0200
@@ -1,38 +1,59 @@
# url-normalize
-[](https://github.com/niksite/url-normalize/actions/workflows/ci.yml)
-[](https://github.com/niksite/url-normalize/actions/workflows/publish.yml)
-
-URI Normalization function:
-
-* Take care of IDN domains.
-* Always provide the URI scheme in lowercase characters.
-* Always provide the host, if any, in lowercase characters.
-* Only perform percent-encoding where it is essential.
-* Always use uppercase A-through-F characters when percent-encoding.
-* Prevent dot-segments appearing in non-relative URI paths.
-* For schemes that define a default authority, use an empty authority if the
+[](https://github.com/niksite/url-normalize/actions/workflows/ci.yml)
+[](https://coveralls.io/r/niksite/url-normalize)
+[](https://pypi.org/project/url-normalize/)
+
+A Python library for standardizing and normalizing URLs with support for
internationalized domain names (IDN).
+
+## Table of Contents
+
+- [Introduction](#introduction)
+- [Features](#features)
+- [Installation](#installation)
+- [Usage](#usage)
+ - [Python API](#python-api)
+ - [Command Line](#command-line-usage)
+- [Documentation](#documentation)
+- [Contributing](#contributing)
+- [License](#license)
+
+## Introduction
+
+url-normalize provides a robust URI normalization function that:
+
+- Takes care of IDN domains.
+- Always provides the URI scheme in lowercase characters.
+- Always provides the host, if any, in lowercase characters.
+- Only performs percent-encoding where it is essential.
+- Always uses uppercase A-through-F characters when percent-encoding.
+- Prevents dot-segments appearing in non-relative URI paths.
+- For schemes that define a default authority, uses an empty authority if the
default is desired.
-* For schemes that define an empty path to be equivalent to a path of "/",
- use "/".
-* For schemes that define a port, use an empty port if the default is desired
-* All portions of the URI must be utf-8 encoded NFC from Unicode strings
+- For schemes that define an empty path to be equivalent to a path of "/",
+ uses "/".
+- For schemes that define a port, uses an empty port if the default is desired
+- Ensures all portions of the URI are utf-8 encoded NFC from Unicode strings
-Inspired by Sam Ruby's
[urlnorm.py](<http://intertwingly.net/blog/2004/08/04/Urlnorm>)
+Inspired by Sam Ruby's
[urlnorm.py](http://intertwingly.net/blog/2004/08/04/Urlnorm)
## Features
-* IDN (Internationalized Domain Name) support
-* Configurable default scheme (https by default)
-* Configurable default domain for absolute paths
-* Query parameter filtering with allowlists
-* Support for various URL formats including:
- * Empty string URLs
- * Double slash URLs (//domain.tld)
- * Shebang (#!) URLs
-* Cross-version Python compatibility (3.8+)
-* 100% test coverage
-* Modern type hints and string handling
+- **IDN Support**: Full internationalized domain name handling
+- **Configurable Defaults**:
+ - Customizable default scheme (https by default)
+ - Configurable default domain for absolute paths
+- **Query Parameter Control**:
+ - Parameter filtering with allowlists
+ - Support for domain-specific parameter rules
+- **Versatile URL Handling**:
+ - Empty string URLs
+ - Double slash URLs (//domain.tld)
+ - Shebang (#!) URLs
+- **Developer Friendly**:
+ - Cross-version Python compatibility (3.8+)
+ - 100% test coverage
+ - Modern type hints and string handling
## Installation
@@ -42,6 +63,8 @@
## Usage
+### Python API
+
```python
from url_normalize import url_normalize
@@ -82,7 +105,7 @@
# Output: http://example.com/images/logo.png
```
-### Command-line usage
+### Command-line Usage
You can also use `url-normalize` from the command line:
@@ -119,6 +142,10 @@
For a complete history of changes, see [CHANGELOG.md](CHANGELOG.md).
+## Contributing
+
+Contributions are welcome! Please feel free to submit a Pull Request.
+
## License
MIT License
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/url-normalize-2.2.0/pyproject.toml
new/url-normalize-2.2.1/pyproject.toml
--- old/url-normalize-2.2.0/pyproject.toml 2025-03-31 05:53:45.000000000
+0200
+++ new/url-normalize-2.2.1/pyproject.toml 2025-04-26 19:40:26.000000000
+0200
@@ -1,12 +1,12 @@
[project]
name = "url-normalize"
-version = "2.2.0"
+version = "2.2.1"
description = "URL normalization for Python"
authors = [{ name = "Nikolay Panov", email = "[email protected]" }]
license = { text = "MIT" }
readme = "README.md"
requires-python = ">=3.8"
-keywords = ["url", "normalization", "normalize"]
+keywords = ["url", "normalization", "normalize", "normalizer"]
dependencies = ["idna>=3.3"]
[project.urls]
@@ -19,16 +19,7 @@
url-normalize = "url_normalize.cli:main"
[project.optional-dependencies]
-dev = [
- "mypy",
- "pre-commit",
- "pytest-cov",
- "pytest-ruff",
- "pytest-socket",
- "pytest",
- "ruff",
- "tox",
-]
+dev = ["mypy", "pre-commit", "pytest-cov", "pytest-socket", "pytest", "ruff"]
[tool.ruff]
target-version = "py38"
@@ -71,11 +62,9 @@
[tool.pytest.ini_options]
addopts = [
- "--cov-fail-under=100",
"--cov-report=term-missing:skip-covered",
"--cov=url_normalize",
"--disable-socket",
- "--ruff",
"-v",
]
python_files = ["tests.py", "test_*.py", "*_tests.py"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/url-normalize-2.2.0/tests/test_deconstruct_url.py
new/url-normalize-2.2.1/tests/test_deconstruct_url.py
--- old/url-normalize-2.2.0/tests/test_deconstruct_url.py 2025-03-31
05:53:45.000000000 +0200
+++ new/url-normalize-2.2.1/tests/test_deconstruct_url.py 2025-04-26
19:40:26.000000000 +0200
@@ -1,35 +1,40 @@
"""Deconstruct url tests."""
-from __future__ import annotations
-
-from typing import Final
+import pytest
from url_normalize.tools import URL, deconstruct_url
-EXPECTED_DATA: Final[dict[str, URL]] = {
- "http://site.com": URL(
- fragment="",
- host="site.com",
- path="",
- port="",
- query="",
- scheme="http",
- userinfo="",
- ),
- "http://[email protected]:8080/path/index.html?param=val#fragment": URL(
- fragment="fragment",
- host="www.example.com",
- path="/path/index.html",
- port="8080",
- query="param=val",
- scheme="http",
- userinfo="user@",
- ),
-}
-
-def test_deconstruct_url_result_is_expected() -> None:
[email protected](
+ ("url", "expected"),
+ [
+ (
+ "http://site.com",
+ URL(
+ fragment="",
+ host="site.com",
+ path="",
+ port="",
+ query="",
+ scheme="http",
+ userinfo="",
+ ),
+ ),
+ (
+
"http://[email protected]:8080/path/index.html?param=val#fragment",
+ URL(
+ fragment="fragment",
+ host="www.example.com",
+ path="/path/index.html",
+ port="8080",
+ query="param=val",
+ scheme="http",
+ userinfo="user@",
+ ),
+ ),
+ ],
+)
+def test_deconstruct_url_result_is_expected(url: str, expected: URL) -> None:
"""Assert we got expected results from the deconstruct_url function."""
- for url, expected in EXPECTED_DATA.items():
- result = deconstruct_url(url)
- assert result == expected, url
+ result = deconstruct_url(url)
+ assert result == expected, url
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/url-normalize-2.2.0/tests/test_normalize_fragment.py
new/url-normalize-2.2.1/tests/test_normalize_fragment.py
--- old/url-normalize-2.2.0/tests/test_normalize_fragment.py 2025-03-31
05:53:45.000000000 +0200
+++ new/url-normalize-2.2.1/tests/test_normalize_fragment.py 2025-04-26
19:40:26.000000000 +0200
@@ -1,21 +1,23 @@
"""Tests for normalize_fragment function."""
-from url_normalize.url_normalize import normalize_fragment
+import pytest
-EXPECTED_DATA = {
- "": "",
- "fragment": "fragment",
- "пример": "%D0%BF%D1%80%D0%B8%D0%BC%D0%B5%D1%80",
- "!fragment": "%21fragment",
- "~fragment": "~fragment",
- # Issue #36: Equal sign should not be encoded
- "gid=1234": "gid=1234",
-}
+from url_normalize.url_normalize import normalize_fragment
-def test_normalize_fragment_result_is_expected():
[email protected](
+ ("fragment", "expected"),
+ [
+ ("", ""),
+ ("fragment", "fragment"),
+ ("пример", "%D0%BF%D1%80%D0%B8%D0%BC%D0%B5%D1%80"),
+ ("!fragment", "%21fragment"),
+ ("~fragment", "~fragment"),
+ # Issue #36: Equal sign should not be encoded
+ ("gid=1234", "gid=1234"),
+ ],
+)
+def test_normalize_fragment_result_is_expected(fragment: str, expected: str)
-> None:
"""Assert we got expected results from the normalize_fragment function."""
- for url, expected in EXPECTED_DATA.items():
- result = normalize_fragment(url)
-
- assert result == expected, url
+ result = normalize_fragment(fragment)
+ assert result == expected, fragment
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/url-normalize-2.2.0/tests/test_normalize_host.py
new/url-normalize-2.2.1/tests/test_normalize_host.py
--- old/url-normalize-2.2.0/tests/test_normalize_host.py 2025-03-31
05:53:45.000000000 +0200
+++ new/url-normalize-2.2.1/tests/test_normalize_host.py 2025-04-26
19:40:26.000000000 +0200
@@ -1,29 +1,32 @@
"""Tests for normalize_host function."""
-from url_normalize.url_normalize import normalize_host
+import pytest
-EXPECTED_DATA = {
- # Basic cases
- "site.com": "site.com",
- "SITE.COM": "site.com",
- "site.com.": "site.com",
- # Cyrillic domains
- "пример.испытание": "xn--e1afmkfd.xn--80akhbyknj4f",
- # Mixed case with Cyrillic
- "ExAmPle.РФ": "example.xn--p1ai",
- # IDNA2008 with UTS46
- "faß.de": "fass.de", # Normalize using transitional rules
- # Edge cases
- "ドメイン.テスト": "xn--eckwd4c7c.xn--zckzah", # Japanese
- "domain.café": "domain.xn--caf-dma", # Latin with diacritic
- # Normalization tests
- "über.example": "xn--ber-goa.example", # IDNA 2008 for umlaut
- "example。com": "example.com", # Normalize full-width punctuation
-}
+from url_normalize.url_normalize import normalize_host
-def test_normalize_host_result_is_expected() -> None:
[email protected](
+ ("host", "expected"),
+ [
+ # Basic cases
+ ("site.com", "site.com"),
+ ("SITE.COM", "site.com"),
+ ("site.com.", "site.com"),
+ # Cyrillic domains
+ ("пример.испытание", "xn--e1afmkfd.xn--80akhbyknj4f"),
+ # Mixed case with Cyrillic
+ ("ExAmPle.РФ", "example.xn--p1ai"),
+ # IDNA2008 with UTS46
+ ("faß.de", "fass.de"), # Normalize using transitional rules
+ # Edge cases
+ ("ドメイン.テスト", "xn--eckwd4c7c.xn--zckzah"), # Japanese
+ ("domain.café", "domain.xn--caf-dma"), # Latin with diacritic
+ # Normalization tests
+ ("über.example", "xn--ber-goa.example"), # IDNA 2008 for umlaut
+ ("example。com", "example.com"), # Normalize full-width punctuation
+ ],
+)
+def test_normalize_host_result_is_expected(host: str, expected: str) -> None:
"""Assert we got expected results from the normalize_host function."""
- for url, expected in EXPECTED_DATA.items():
- result = normalize_host(url)
- assert result == expected, url
+ result = normalize_host(host)
+ assert result == expected, host
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/url-normalize-2.2.0/tests/test_normalize_path.py
new/url-normalize-2.2.1/tests/test_normalize_path.py
--- old/url-normalize-2.2.0/tests/test_normalize_path.py 2025-03-31
05:53:45.000000000 +0200
+++ new/url-normalize-2.2.1/tests/test_normalize_path.py 2025-04-26
19:40:26.000000000 +0200
@@ -1,42 +1,44 @@
"""Tests for normalize_path function."""
-from url_normalize.url_normalize import normalize_path
+import pytest
-EXPECTED_DATA = {
- "..": "/",
- "": "/",
- "/../foo": "/foo",
- "/..foo": "/..foo",
- "/./../foo": "/foo",
- "/./foo": "/foo",
- "/./foo/.": "/foo/",
- "/.foo": "/.foo",
- "/": "/",
- "/foo..": "/foo..",
- "/foo.": "/foo.",
- "/FOO": "/FOO",
- "/foo/../bar": "/bar",
- "/foo/./bar": "/foo/bar",
- "/foo//": "/foo/",
- "/foo///bar//": "/foo/bar/",
- "/foo/bar/..": "/foo/",
- "/foo/bar/../..": "/",
- "/foo/bar/../../../../baz": "/baz",
- "/foo/bar/../../../baz": "/baz",
- "/foo/bar/../../": "/",
- "/foo/bar/../../baz": "/baz",
- "/foo/bar/../": "/foo/",
- "/foo/bar/../baz": "/foo/baz",
- "/foo/bar/.": "/foo/bar/",
- "/foo/bar/./": "/foo/bar/",
- # Issue #25: we should preserve ? in the path
- "/More+Tea+Vicar%3F/discussion": "/More+Tea+Vicar%3F/discussion",
-}
+from url_normalize.url_normalize import normalize_path
-def test_normalize_path_result_is_expected():
[email protected](
+ ("path", "expected"),
+ [
+ ("..", "/"),
+ ("", "/"),
+ ("/../foo", "/foo"),
+ ("/..foo", "/..foo"),
+ ("/./../foo", "/foo"),
+ ("/./foo", "/foo"),
+ ("/./foo/.", "/foo/"),
+ ("/.foo", "/.foo"),
+ ("/", "/"),
+ ("/foo..", "/foo.."),
+ ("/foo.", "/foo."),
+ ("/FOO", "/FOO"),
+ ("/foo/../bar", "/bar"),
+ ("/foo/./bar", "/foo/bar"),
+ ("/foo//", "/foo/"),
+ ("/foo///bar//", "/foo/bar/"),
+ ("/foo/bar/..", "/foo/"),
+ ("/foo/bar/../..", "/"),
+ ("/foo/bar/../../../../baz", "/baz"),
+ ("/foo/bar/../../../baz", "/baz"),
+ ("/foo/bar/../../", "/"),
+ ("/foo/bar/../../baz", "/baz"),
+ ("/foo/bar/../", "/foo/"),
+ ("/foo/bar/../baz", "/foo/baz"),
+ ("/foo/bar/.", "/foo/bar/"),
+ ("/foo/bar/./", "/foo/bar/"),
+ # Issue #25: we should preserve ? in the path
+ ("/More+Tea+Vicar%3F/discussion", "/More+Tea+Vicar%3F/discussion"),
+ ],
+)
+def test_normalize_path_result_is_expected(path: str, expected: str) -> None:
"""Assert we got expected results from the normalize_path function."""
- for url, expected in EXPECTED_DATA.items():
- result = normalize_path(url, "http")
-
- assert result == expected, url
+ result = normalize_path(path, "http")
+ assert result == expected, path
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/url-normalize-2.2.0/tests/test_normalize_port.py
new/url-normalize-2.2.1/tests/test_normalize_port.py
--- old/url-normalize-2.2.0/tests/test_normalize_port.py 2025-03-31
05:53:45.000000000 +0200
+++ new/url-normalize-2.2.1/tests/test_normalize_port.py 2025-04-26
19:40:26.000000000 +0200
@@ -1,13 +1,26 @@
"""Tests for normalize_port function."""
-from url_normalize.url_normalize import normalize_port
+import pytest
-EXPECTED_DATA = {"8080": "8080", "": "", "80": "", "string": "string"}
+from url_normalize.url_normalize import normalize_port
-def test_normalize_port_result_is_expected():
[email protected](
+ ("port", "expected"),
+ [
+ ("8080", "8080"), # Non-default port
+ ("", ""), # Empty port
+ ("80", ""), # Default HTTP port
+ ("string", "string"), # Non-numeric port (should pass through)
+ # Add more cases as needed, e.g., for HTTPS
+ pytest.param("443", "", id="https_default_port"),
+ ],
+)
+def test_normalize_port_result_is_expected(port: str, expected: str):
"""Assert we got expected results from the normalize_port function."""
- for url, expected in EXPECTED_DATA.items():
- result = normalize_port(url, "http")
+ # Test with 'http' scheme for most cases
+ scheme = "https" if port == "443" else "http"
+
+ result = normalize_port(port, scheme)
- assert result == expected, url
+ assert result == expected
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/url-normalize-2.2.0/tests/test_normalize_scheme.py
new/url-normalize-2.2.1/tests/test_normalize_scheme.py
--- old/url-normalize-2.2.0/tests/test_normalize_scheme.py 2025-03-31
05:53:45.000000000 +0200
+++ new/url-normalize-2.2.1/tests/test_normalize_scheme.py 2025-04-26
19:40:26.000000000 +0200
@@ -1,13 +1,18 @@
"""Tests for normalize_scheme function."""
-from url_normalize.url_normalize import normalize_scheme
+import pytest
-EXPECTED_DATA = {"http": "http", "HTTP": "http"}
+from url_normalize.url_normalize import normalize_scheme
-def test_normalize_scheme_result_is_expected():
[email protected](
+ ("scheme", "expected"),
+ [
+ ("http", "http"),
+ ("HTTP", "http"),
+ ],
+)
+def test_normalize_scheme_result_is_expected(scheme: str, expected: str) ->
None:
"""Assert we got expected results from the normalize_scheme function."""
- for url, expected in EXPECTED_DATA.items():
- result = normalize_scheme(url)
-
- assert result == expected, url
+ result = normalize_scheme(scheme)
+ assert result == expected, scheme
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/url-normalize-2.2.0/tests/test_normalize_userinfo.py
new/url-normalize-2.2.1/tests/test_normalize_userinfo.py
--- old/url-normalize-2.2.0/tests/test_normalize_userinfo.py 2025-03-31
05:53:45.000000000 +0200
+++ new/url-normalize-2.2.1/tests/test_normalize_userinfo.py 2025-04-26
19:40:26.000000000 +0200
@@ -1,19 +1,21 @@
"""Tests for normalize_userinfo function."""
-from url_normalize.url_normalize import normalize_userinfo
+import pytest
-EXPECTED_DATA = {
- ":@": "",
- "": "",
- "@": "",
- "user:password@": "user:password@",
- "user@": "user@",
-}
+from url_normalize.url_normalize import normalize_userinfo
-def test_normalize_userinfo_result_is_expected():
[email protected](
+ ("userinfo", "expected"),
+ [
+ (":@", ""),
+ ("", ""),
+ ("@", ""),
+ ("user:password@", "user:password@"),
+ ("user@", "user@"),
+ ],
+)
+def test_normalize_userinfo_result_is_expected(userinfo: str, expected: str)
-> None:
"""Assert we got expected results from the normalize_userinfo function."""
- for url, expected in EXPECTED_DATA.items():
- result = normalize_userinfo(url)
-
- assert result == expected, url
+ result = normalize_userinfo(userinfo)
+ assert result == expected, userinfo
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/url-normalize-2.2.0/tests/test_provide_url_scheme.py
new/url-normalize-2.2.1/tests/test_provide_url_scheme.py
--- old/url-normalize-2.2.0/tests/test_provide_url_scheme.py 2025-03-31
05:53:45.000000000 +0200
+++ new/url-normalize-2.2.1/tests/test_provide_url_scheme.py 2025-04-26
19:40:26.000000000 +0200
@@ -1,26 +1,28 @@
"""Tests for provide_url_scheme function."""
-from url_normalize.url_normalize import provide_url_scheme
+import pytest
-EXPECTED_DATA = {
- "": "",
- "-": "-",
- "/file/path": "/file/path",
- "//site/path": "https://site/path",
- "ftp://site/": "ftp://site/",
- "site/page": "https://site/page",
-}
+from url_normalize.url_normalize import provide_url_scheme
-def test_provide_url_scheme_result_is_expected():
[email protected](
+ ("url", "expected"),
+ [
+ ("", ""),
+ ("-", "-"),
+ ("/file/path", "/file/path"),
+ ("//site/path", "https://site/path"),
+ ("ftp://site/", "ftp://site/"),
+ ("site/page", "https://site/page"),
+ ],
+)
+def test_provide_url_scheme_result_is_expected(url: str, expected: str) ->
None:
"""Assert we got expected results from the provide_url_scheme function."""
- for url, expected in EXPECTED_DATA.items():
- result = provide_url_scheme(url)
-
- assert result == expected, url
+ result = provide_url_scheme(url)
+ assert result == expected, url
-def test_provide_url_scheme_accept_default_scheme_param():
+def test_provide_url_scheme_accept_default_scheme_param() -> None:
"""Assert we could provide default_scheme param other than https."""
url = "//site/path"
expected = "http://site/path"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/url-normalize-2.2.0/tests/test_reconstruct_url.py
new/url-normalize-2.2.1/tests/test_reconstruct_url.py
--- old/url-normalize-2.2.0/tests/test_reconstruct_url.py 2025-03-31
05:53:45.000000000 +0200
+++ new/url-normalize-2.2.1/tests/test_reconstruct_url.py 2025-04-26
19:40:26.000000000 +0200
@@ -2,40 +2,41 @@
from __future__ import annotations
-from typing import Final
+import pytest
from url_normalize.tools import URL, reconstruct_url
-EXPECTED_DATA: Final[tuple[tuple[URL, str], ...]] = (
- (
- URL(
- fragment="",
- host="site.com",
- path="",
- port="",
- query="",
- scheme="http",
- userinfo="",
+
[email protected](
+ ("url_obj", "expected"),
+ [
+ (
+ URL(
+ fragment="",
+ host="site.com",
+ path="",
+ port="",
+ query="",
+ scheme="http",
+ userinfo="",
+ ),
+ "http://site.com",
),
- "http://site.com",
- ),
- (
- URL(
- fragment="fragment",
- host="www.example.com",
- path="/path/index.html",
- port="8080",
- query="param=val",
- scheme="http",
- userinfo="user@",
+ (
+ URL(
+ fragment="fragment",
+ host="www.example.com",
+ path="/path/index.html",
+ port="8080",
+ query="param=val",
+ scheme="http",
+ userinfo="user@",
+ ),
+
"http://[email protected]:8080/path/index.html?param=val#fragment",
),
- "http://[email protected]:8080/path/index.html?param=val#fragment",
- ),
+ ],
)
-
-
-def test_deconstruct_url_result_is_expected() -> None:
- """Assert we got expected results from the deconstruct_url function."""
- for url, expected in EXPECTED_DATA:
- result = reconstruct_url(url)
- assert result == expected, url
+def test_reconstruct_url_result_is_expected(url_obj: URL, expected: str) ->
None:
+ """Assert we got expected results from the reconstruct_url function."""
+ result = reconstruct_url(url_obj)
+ assert result == expected, url_obj
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/url-normalize-2.2.0/tox.ini
new/url-normalize-2.2.1/tox.ini
--- old/url-normalize-2.2.0/tox.ini 2025-03-31 05:53:45.000000000 +0200
+++ new/url-normalize-2.2.1/tox.ini 1970-01-01 01:00:00.000000000 +0100
@@ -1,21 +0,0 @@
-[tox]
-envlist = py38,py39,py310,py311,py312,py313
-isolated_build = True
-
-[testenv]
-allowlist_externals = uv
-deps =
- pytest
- uv
-commands =
- uv pip install -e .[dev]
- pytest
-
-[gh-actions]
-python =
- 3.8: py38
- 3.9: py39
- 3.10: py310
- 3.11: py311
- 3.12: py312
- 3.13: py313
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/url-normalize-2.2.0/url_normalize/__init__.py
new/url-normalize-2.2.1/url_normalize/__init__.py
--- old/url-normalize-2.2.0/url_normalize/__init__.py 2025-03-31
05:53:45.000000000 +0200
+++ new/url-normalize-2.2.1/url_normalize/__init__.py 2025-04-26
19:40:26.000000000 +0200
@@ -8,6 +8,6 @@
from .url_normalize import url_normalize
__license__ = "MIT"
-__version__ = "2.2.0"
+__version__ = "2.2.1"
__all__ = ["url_normalize"]