<commit_before># -*- coding: utf-8 -*-

import imgix
import urlparse

def default_builder():
    return imgix.UrlBuilder('my-social-network.imgix.net')

def default_builder_with_signature():
    return imgix.UrlBuilder('my-social-network.imgix.net', False, "FOO123bar")

def test_smoke():
    assert True

def test_url_builder_create():
    builder = imgix.UrlBuilder('my-social-network.imgix.net')
    assert type(builder) is imgix.UrlBuilder

def test_url_builder_create_url_with_path():
    builder = default_builder()
    url = builder.create_url("/users/1.png")
    assert url == "http://my-social-network.imgix.net/users/1.png"

def test_url_builder_create_url_with_path_and_parameters():
    builder = default_builder()
    url = builder.create_url("/users/1.png", w=400, h=300)
    assert url == "http://my-social-network.imgix.net/users/1.png?h=300&w=400"

def test_url_builder_create_url_with_path_and_signature():
    builder = default_builder_with_signature()
    url = builder.create_url("/users/1.png")
    assert url == "http://my-social-network.imgix.net/users/1.png?s=6797c24146142d5b40bde3141fd3600c"

def test_url_builder_create_url_with_path_and_paremeters_and_signature():
    builder = default_builder_with_signature()
    url = builder.create_url("/users/1.png", w=400, h=300)
    assert url == "http://my-social-network.imgix.net/users/1.png?h=300&w=400&s=1a4e48641614d1109c6a7af51be23d18"

def test_url_builder_create_url_with_fully_qualified_url():
    builder = default_builder_with_signature()
    url = builder.create_url("http://avatars.com/john-smith.png")
    assert url == "http://my-social-network.imgix.net/http%3A%2F%2Favatars.com%2Fjohn-smith.png?s=493a52f008c91416351f8b33d4883135"

def test_url_builder_create_url_with_fully_qualified_url_and_parameters():
    builder = default_builder_with_signature()
    url = builder.create_url("http://avatars.com/john-smith.png", w=400, h=300)
    assert url == "http://my-social-network.imgix.net/http%3A%2F%2Favatars.com%2Fjohn-smith.png?h=300&w=400&s=a201fe1a3caef4944dcb40f6ce99e746"

def test_url_builder_use_https():
    # Defaults to http
    builder = imgix.UrlBuilder('my-social-network.imgix.net')
    url = builder.create_url("/users/1.png")
    assert urlparse.urlparse(url).scheme == "http"

    builder = imgix.UrlBuilder('my-social-network.imgix.net', use_https=False)
    url = builder.create_url("/users/1.png")
    assert urlparse.urlparse(url).scheme == "http"

    builder = imgix.UrlBuilder('my-social-network.imgix.net', True)
    url = builder.create_url("/users/1.png")
    assert urlparse.urlparse(url).scheme == "https"

    builder = imgix.UrlBuilder('my-social-network.imgix.net', use_https=True)
    url = builder.create_url("/users/1.png")
    assert urlparse.urlparse(url).scheme == "https"<commit_msg>Failing test for UTF-8 encoding<commit_after># -*- coding: utf-8 -*-

import imgix
import urlparse

def default_builder():
    return imgix.UrlBuilder('my-social-network.imgix.net')

def default_builder_with_signature():
    return imgix.UrlBuilder('my-social-network.imgix.net', False, "FOO123bar")

def test_smoke():
    assert True

def test_url_builder_create():
    builder = imgix.UrlBuilder('my-social-network.imgix.net')
    assert type(builder) is imgix.UrlBuilder

def test_url_builder_create_url_with_path():
    builder = default_builder()
    url = builder.create_url("/users/1.png")
    assert url == "http://my-social-network.imgix.net/users/1.png"

def test_url_builder_create_url_with_path_and_parameters():
    builder = default_builder()
    url = builder.create_url("/users/1.png", w=400, h=300)
    assert url == "http://my-social-network.imgix.net/users/1.png?h=300&w=400"

def test_url_builder_create_url_with_path_and_signature():
    builder = default_builder_with_signature()
    url = builder.create_url("/users/1.png")
    assert url == "http://my-social-network.imgix.net/users/1.png?s=6797c24146142d5b40bde3141fd3600c"

def test_url_builder_create_url_with_path_and_paremeters_and_signature():
    builder = default_builder_with_signature()
    url = builder.create_url("/users/1.png", w=400, h=300)
    assert url == "http://my-social-network.imgix.net/users/1.png?h=300&w=400&s=1a4e48641614d1109c6a7af51be23d18"

def test_url_builder_create_url_with_fully_qualified_url():
    builder = default_builder_with_signature()
    url = builder.create_url("http://avatars.com/john-smith.png")
    assert url == "http://my-social-network.imgix.net/http%3A%2F%2Favatars.com%2Fjohn-smith.png?s=493a52f008c91416351f8b33d4883135"

def test_url_builder_create_url_with_fully_qualified_url_and_parameters():
    builder = default_builder_with_signature()
    url = builder.create_url("http://avatars.com/john-smith.png", w=400, h=300)
    assert url == "http://my-social-network.imgix.net/http%3A%2F%2Favatars.com%2Fjohn-smith.png?h=300&w=400&s=a201fe1a3caef4944dcb40f6ce99e746"

def test_url_builder_use_https():
    # Defaults to http
    builder = imgix.UrlBuilder('my-social-network.imgix.net')
    url = builder.create_url("/users/1.png")
    assert urlparse.urlparse(url).scheme == "http"

    builder = imgix.UrlBuilder('my-social-network.imgix.net', use_https=False)
    url = builder.create_url("/users/1.png")
    assert urlparse.urlparse(url).scheme == "http"

    builder = imgix.UrlBuilder('my-social-network.imgix.net', True)
    url = builder.create_url("/users/1.png")
    assert urlparse.urlparse(url).scheme == "https"

    builder = imgix.UrlBuilder('my-social-network.imgix.net', use_https=True)
    url = builder.create_url("/users/1.png")
    assert urlparse.urlparse(url).scheme == "https"

def test_utf_8_characters():
    builder = imgix.UrlBuilder('my-social-network.imgix.net')
    url = builder.create_url(u'/ǝ'.encode('utf8'))
    assert url == "http://my-social-network.imgix.net/%C7%9D"
{'fraction_non_alphanumeric': 0.14366341713699332, 'fraction_numerical': 0.05147939114075594, 'mean_word_length': 4.955193482688391, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5687254', 'n_tokens_mistral': 2291, 'n_tokens_neox': 2129, 'n_words': 262}