<commit_before>package jamaica.core.http;

import org.testng.annotations.*;
import static org.testng.AssertJUnit.*;

public class html {

    /**
     * Convert page-relative URLs (e.g. "foo/bar") in the given HTML content
     * to absolute URLs by preprending the given base URL. URLs relative to
     * the domain root are not modified (e.g. "/foo/bar").
     * 
     * Only src and href attributes are modified. A full list of possible
     * attributes with URL values can be found at
     * http://stackoverflow.com/questions/2725156
     * 
     * This function does not validate the baseURL.
     */
    @Test public void make_urls_absolute__processes_relative_urls() {
        assertEquals(make_urls_absolute(
                "<a href=\"foo/bar.jpg\"/>", "http://example.com"), 
                "<a href=\"http://example.com/foo/bar.jpg\"/>");
    }
    @Test public void make_urls_absolute__processes_src_attributes() {
        assertEquals(make_urls_absolute(
                "<img src=\"foo/bar.jpg\"/>", "http://example.com"), 
                "<img src=\"http://example.com/foo/bar.jpg\"/>");
    }
    @Test public void make_urls_absolute__processes_href_attributes() {
        assertEquals(make_urls_absolute(
                "<a href=\"foo/bar.jpg\"/>", "http://example.com"), 
                "<a href=\"http://example.com/foo/bar.jpg\"/>");
    }
    @Test public void make_urls_absolute__does_not_process_plain_text() {
        assertEquals(make_urls_absolute(
                "foo/bar.jpg", "http://example.com"), 
                "foo/bar.jpg");
    }
    @Test public void make_urls_absolute__processes_single_quoted_attributes() {
        assertEquals(make_urls_absolute(
                "<a href='foo/bar.jpg'/>", "http://example.com"), 
                "<a href='http://example.com/foo/bar.jpg'/>");
    }
    @Test public void make_urls_absolute__does_not_process_absolute_http_urls() {
        assertEquals(make_urls_absolute(
                "<a href=\"http://helloworld.com/foo/bar.jpg\"/>", "http://example.com"), <commit_msg>remove dead comments<commit_after>package jamaica.core.http;

import org.testng.annotations.*;
import static org.testng.AssertJUnit.*;

public class html {

    // make_urls_absolute
    @Test public void make_urls_absolute__processes_relative_urls() {
        assertEquals(make_urls_absolute(
                "<a href=\"foo/bar.jpg\"/>", "http://example.com"), 
                "<a href=\"http://example.com/foo/bar.jpg\"/>");
    }
    @Test public void make_urls_absolute__processes_src_attributes() {
        assertEquals(make_urls_absolute(
                "<img src=\"foo/bar.jpg\"/>", "http://example.com"), 
                "<img src=\"http://example.com/foo/bar.jpg\"/>");
    }
    @Test public void make_urls_absolute__processes_href_attributes() {
        assertEquals(make_urls_absolute(
                "<a href=\"foo/bar.jpg\"/>", "http://example.com"), 
                "<a href=\"http://example.com/foo/bar.jpg\"/>");
    }
    @Test public void make_urls_absolute__does_not_process_plain_text() {
        assertEquals(make_urls_absolute(
                "foo/bar.jpg", "http://example.com"), 
                "foo/bar.jpg");
    }
    @Test public void make_urls_absolute__processes_single_quoted_attributes() {
        assertEquals(make_urls_absolute(
                "<a href='foo/bar.jpg'/>", "http://example.com"), 
                "<a href='http://example.com/foo/bar.jpg'/>");
    }
    @Test public void make_urls_absolute__does_not_process_absolute_http_urls() {
        assertEquals(make_urls_absolute(
                "<a href=\"http://helloworld.com/foo/bar.jpg\"/>", "http://example.com"), 
{'fraction_non_alphanumeric': 0.15229806907805277, 'fraction_numerical': 0.0019037258634756595, 'mean_word_length': 2.519617224880383, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '4107125', 'n_tokens_mistral': 1121, 'n_tokens_neox': 1122, 'n_words': 193}