From 6d2e9f4faecfe7615ee8184182c659e70abb1395 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Tue, 2 Oct 2018 13:13:16 +0100 Subject: [PATCH] replace -> replace_components (Avoid clashing with str builtin) --- starlette/datastructures.py | 2 +- tests/test_datastructures.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/starlette/datastructures.py b/starlette/datastructures.py index 1b5e951f..02dbafa9 100644 --- a/starlette/datastructures.py +++ b/starlette/datastructures.py @@ -49,7 +49,7 @@ class URL(str): def port(self) -> typing.Optional[int]: return self.components.port - def replace(self, **kwargs: typing.Any) -> "URL": # type: ignore + def replace_components(self, **kwargs: typing.Any) -> "URL": # type: ignore components = self.components._replace(**kwargs) return URL(components.geturl()) diff --git a/tests/test_datastructures.py b/tests/test_datastructures.py index 672feaa7..58298164 100644 --- a/tests/test_datastructures.py +++ b/tests/test_datastructures.py @@ -13,7 +13,7 @@ def test_url(): assert u.query == "abc=123" assert u.params == "" assert u.fragment == "anchor" - new = u.replace(scheme="http") + new = u.replace_components(scheme="http") assert new == "http://example.org:123/path/to/somewhere?abc=123#anchor" assert new.scheme == "http"