BlackPythonDevs / blackpythondevs.github.io

Website for Black Python Devs
https://blackpythondevs.com
MIT License
33 stars 53 forks source link

url in conferences will not replace invalid url #504

Closed kjaymiller closed 1 month ago

kjaymiller commented 1 month ago

When you pass in a url with an invalid protocol, the url is replaced but the protocol is not replaced.

============================================================================ FAILURES ============================================================================ ******___****** test_normalizeurl[ftp://pycon.us] ******__\******

test_url = 'ftp://pycon.us'

@pytest.mark.parametrize("test_url", ["pycon.us", "https://pycon.us", "ftp://pycon.us"])
def test_normalize_url(test_url: str):
    """
    Tests that urls are valid URLs with https:// protocols
    """
  assert conferences.normalize_url(test_url) == "https://pycon.us"

E AssertionError: assert 'https://ftp://pycon.us' == 'https://pycon.us' E E - https://pycon.us E + https://ftp://pycon.us E ? ++++++

tests/tests_conferences.py:12: AssertionError

kjaymiller commented 1 month ago

@dragid10 you were working on this. I wasn't sure if you wanted to look at it. This is coming after some refactors in #503

dragid10 commented 1 month ago

Oooo interesting! I'm happy to take a look at it but if others want to get to it before me, then that's fine! I don't want to block anyone else from potentially taking this

kjaymiller commented 1 month ago

up for anyone

dragid10 commented 1 month ago

Okay I actually thought of a solution because my brain was in the zone with this!