<commit_before>import random

from pages.treeherder import TreeherderPage


def test_pin_job(base_url, selenium):
    """Open treeherder page, select first job and pin it"""
    page = TreeherderPage(selenium, base_url).open()
    job = random.choice(page.all_jobs)
    job.click()
    assert 0 == len(page.pinboard.jobs)
    page.pin_using_spacebar()
    assert 1 == len(page.pinboard.jobs)
    assert job.symbol == page.pinboard.selected_job.symbol


def test_pin_job_from_job_details(base_url, selenium):
    """Open treeherder page, select first job, pin it by the pin icon"""
    page = TreeherderPage(selenium, base_url).open()
    job = random.choice(page.all_jobs)
    job.click()
    assert 0 == len(page.pinboard.jobs)
    page.info_panel.job_details.pin_job()
    assert 1 == len(page.pinboard.jobs)
    assert job.symbol == page.pinboard.selected_job.symbol


def test_clear_pinboard(base_url, selenium):
    """Open treeherder page, pin a job and then clear the pinboard"""
    page = TreeherderPage(selenium, base_url).open()
    random.choice(page.all_jobs).click()
    page.pin_using_spacebar()
    assert 1 == len(page.pinboard.jobs)
    page.pinboard.clear_pinboard()
    assert page.pinboard.is_pinboard_open
    assert 0 == len(page.pinboard.jobs)


def test_pin_all_jobs(base_url, selenium):
    """Open treeherder page, pin all jobs, confirm no more than 500 pins in pinboard"""
    page = TreeherderPage(selenium, base_url).open()
    result_set = next(r for r in page.result_sets if len(r.jobs) > 1)
    result_set.pin_all_jobs()
    assert len(result_set.jobs) <= len(page.pinboard.jobs) < 500<commit_msg>Jenkins: Fix test_pin_all_jobs to allow for the maximum number of 500 pinned jobs (#2889)<commit_after>import random

from pages.treeherder import TreeherderPage


def test_pin_job(base_url, selenium):
    """Open treeherder page, select first job and pin it"""
    page = TreeherderPage(selenium, base_url).open()
    job = random.choice(page.all_jobs)
    job.click()
    assert 0 == len(page.pinboard.jobs)
    page.pin_using_spacebar()
    assert 1 == len(page.pinboard.jobs)
    assert job.symbol == page.pinboard.selected_job.symbol


def test_pin_job_from_job_details(base_url, selenium):
    """Open treeherder page, select first job, pin it by the pin icon"""
    page = TreeherderPage(selenium, base_url).open()
    job = random.choice(page.all_jobs)
    job.click()
    assert 0 == len(page.pinboard.jobs)
    page.info_panel.job_details.pin_job()
    assert 1 == len(page.pinboard.jobs)
    assert job.symbol == page.pinboard.selected_job.symbol


def test_clear_pinboard(base_url, selenium):
    """Open treeherder page, pin a job and then clear the pinboard"""
    page = TreeherderPage(selenium, base_url).open()
    random.choice(page.all_jobs).click()
    page.pin_using_spacebar()
    assert 1 == len(page.pinboard.jobs)
    page.pinboard.clear_pinboard()
    assert page.pinboard.is_pinboard_open
    assert 0 == len(page.pinboard.jobs)


def test_pin_all_jobs(base_url, selenium):
    """Open treeherder page, pin all jobs, confirm no more than 500 pins in pinboard"""
    page = TreeherderPage(selenium, base_url).open()
    result_set = next(r for r in page.result_sets if len(r.jobs) > 1)
    result_set.pin_all_jobs()
    assert len(result_set.jobs) <= len(page.pinboard.jobs) <= 500
{'fraction_non_alphanumeric': 0.11357506742583158, 'fraction_numerical': 0.009889121965837579, 'mean_word_length': 4.135384615384615, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '7641780', 'n_tokens_mistral': 1202, 'n_tokens_neox': 1103, 'n_words': 266}