<s> import os <EOL> from flask_redis import parse_url <EOL> import pytest <EOL> def test_bad_urls ( ) : <EOL> """<STR_LIT>""" <EOL> urls = [ None , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> for url in urls : <EOL> with pytest . raises ( ValueError ) : <EOL> parse_url ( url ) <EOL> def test_network_urls ( ) : <EOL> """<STR_LIT>""" <EOL> actual = parse_url ( '<STR_LIT>' ) <EOL> assert dict ( password = '<STR_LIT>' , host = '<STR_LIT:localhost>' , port = <NUM_LIT> , db = <NUM_LIT:1> ) == actual <EOL> actual = parse_url ( '<STR_LIT>' ) <EOL> assert dict ( host = '<STR_LIT>' , port = <NUM_LIT> , db = <NUM_LIT:1> ) == actual <EOL> actual = parse_url ( '<STR_LIT>' ) <EOL> assert dict ( host = '<STR_LIT>' , port = <NUM_LIT> ) == actual <EOL> actual = parse_url ( '<STR_LIT>' ) <EOL> assert dict ( password = '<STR_LIT>' , host = '<STR_LIT:localhost>' ) == actual <EOL> actual = parse_url ( '<STR_LIT>' ) <EOL> assert dict ( host = '<STR_LIT:localhost>' , db = <NUM_LIT:2> ) == actual <EOL> actual = parse_url ( '<STR_LIT>' ) <EOL> assert dict ( host = '<STR_LIT:localhost>' ) == actual <EOL> actual = parse_url ( '<STR_LIT>' ) <EOL> assert dict ( host = '<STR_LIT:localhost>' ) == actual <EOL> def test_socket_paths_implicit ( ) : <EOL> actual = parse_url ( '<STR_LIT>' ) <EOL> assert dict ( password = '<STR_LIT>' , unix_socket_path = '<STR_LIT>' ) == actual <EOL> actual = parse_url ( '<STR_LIT>' ) <EOL> assert dict ( password = '<STR_LIT>' , unix_socket_path = '<STR_LIT>' ) == actual <EOL> actual = parse_url ( '<STR_LIT>' ) <EOL> assert dict ( unix_socket_path = '<STR_LIT>' ) == actual <EOL> actual = parse_url ( '<STR_LIT>' ) <EOL> assert dict ( unix_socket_path = '<STR_LIT>' ) == actual <EOL> if os . name != '<STR_LIT>' : <EOL> actual = parse_url ( '<STR_LIT>' ) <EOL> assert dict ( password = '<STR_LIT>' , unix_socket_path = '<STR_LIT>' ) == actual <EOL> actual = parse_url ( '<STR_LIT>' ) <EOL> assert dict ( unix_socket_path = '<STR_LIT>' ) == actual <EOL> else : <EOL> actual = parse_url ( '<STR_LIT>' ) <EOL> assert dict ( password = '<STR_LIT>' , unix_socket_path = '<STR_LIT>' ) == actual <EOL> actual = parse_url ( '<STR_LIT>' ) <EOL> assert dict ( unix_socket_path = '<STR_LIT>' ) == actual <EOL> @ pytest . mark . parametrize ( '<STR_LIT>' , ( '<STR_LIT:file>' , '<STR_LIT>' ) ) <EOL> def test_socket_paths_explicit ( prefix ) : <EOL> actual = parse_url ( prefix + '<STR_LIT>' ) <EOL> assert dict ( password = '<STR_LIT>' , unix_socket_path = '<STR_LIT>' ) == actual <EOL> actual = parse_url ( prefix + '<STR_LIT>' ) <EOL> assert dict ( password = '<STR_LIT>' , unix_socket_path = '<STR_LIT>' ) == actual <EOL> actual = parse_url ( prefix + '<STR_LIT>' ) <EOL> assert dict ( password = '<STR_LIT>' , unix_socket_path = '<STR_LIT>' ) == actual <EOL> actual = parse_url ( prefix + '<STR_LIT>' ) <EOL> assert dict ( unix_socket_path = '<STR_LIT>' ) == actual <EOL> actual = parse_url ( prefix + '<STR_LIT>' ) <EOL> assert dict ( unix_socket_path = '<STR_LIT>' ) == actual <EOL> actual = parse_url ( prefix + '<STR_LIT>' ) <EOL> assert dict ( unix_socket_path = '<STR_LIT>' ) == actual <EOL> if os . name != '<STR_LIT>' : <EOL> actual = parse_url ( prefix + '<STR_LIT>' ) <EOL> assert dict ( password = '<STR_LIT>' , unix_socket_path = '<STR_LIT>' ) == actual <EOL> actual = parse_url ( prefix + '<STR_LIT>' ) <EOL> assert dict ( unix_socket_path = '<STR_LIT>' ) == actual <EOL> else : <EOL> actual = parse_url ( prefix + '<STR_LIT>' ) <EOL> assert dict ( password = '<STR_LIT>' , unix_socket_path = '<STR_LIT>' ) == actual <EOL> actual = parse_url ( prefix + '<STR_LIT>' ) <EOL> assert dict ( unix_socket_path = '<STR_LIT>' ) == actual </s>
