<commit_before>import os

import pytest
from selenium.common.exceptions import TimeoutException

from selene import config
from selene.conditions import exact_text
from selene.tools import visit, make_screenshot, s

start_page = 'file://' + os.path.abspath(os.path.dirname(__file__)) + '/../resources/start_page.html'


def test_can_make_screenshot_with_default_name():
    visit(start_page)
    path = make_screenshot()
    assert "/Users/sepi/screenshots/screen_0.png" == path


def test_can_make_screenshot_with_custom_name():
    visit(start_page)
    path = make_screenshot(filename="custom")
    assert "/Users/sepi/screenshots/custom_1.png" == path


def test_can_save_screenshot_to_custom_folder():
    config.screenshot_folder = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    visit(start_page)
    path = make_screenshot()
    assert "/Users/sepi/PycharmProjects/selene/tests/screen_2.png" == path
    assert os.path.isfile(path)


def test_can_make_screenshot_automatically():
    visit(start_page)
    with pytest.raises(TimeoutException):
        s("#selene_link").should_have(exact_text("Selen site"))
    assert os.path.exists("/Users/sepi/PycharmProjects/selene/tests/screen_3.png")
<commit_msg>test fixed<commit_after>import os

import pytest
from selenium.common.exceptions import TimeoutException

from selene import config
from selene.conditions import exact_text
from selene.tools import visit, make_screenshot, s

start_page = 'file://' + os.path.abspath(os.path.dirname(__file__)) + '/../resources/start_page.html'


def test_can_make_screenshot_with_default_name():
    visit(start_page)
    path = make_screenshot()
    assert "/Users/sepi/.selene/screenshots/screen_0.png" == path


def test_can_make_screenshot_with_custom_name():
    visit(start_page)
    path = make_screenshot(filename="custom")
    assert "/Users/sepi/.selene/screenshots/custom_1.png" == path


def test_can_save_screenshot_to_custom_folder():
    config.screenshot_folder = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    visit(start_page)
    path = make_screenshot()
    assert "/Users/sepi/PycharmProjects/selene/tests/screen_2.png" == path
    assert os.path.isfile(path)


def test_can_make_screenshot_automatically():
    visit(start_page)
    with pytest.raises(TimeoutException):
        s("#selene_link").should_have(exact_text("Selen site"))
    assert os.path.exists("/Users/sepi/PycharmProjects/selene/tests/screen_3.png")

{'fraction_non_alphanumeric': 0.11593027969193352, 'fraction_numerical': 0.0032428050263477908, 'mean_word_length': 5.049019607843137, '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': '2122806', 'n_tokens_mistral': 862, 'n_tokens_neox': 847, 'n_words': 127}