<commit_before># pylint: disable=C0111
# pylint: disable=W0621

from lettuce import world, step
from common import *
from nose.tools import assert_equal  # pylint: disable=E0611


@step('I click the New Section link$')
def i_click_new_section_link(_step):
    link_css = 'a.new-courseware-section-button'
    world.css_click(link_css)


@step('I enter the section name and click save$')
def i_save_section_name(_step):
    save_section_name('My Section')


@step('I enter a section name with a quote and click save$')
def i_save_section_name_with_quote(_step):
    save_section_name('Section with "Quote"')


@step('I have added a new section$')
def i_have_added_new_section(_step):
    add_section()


@step('I click the Edit link for the release date$')
def i_click_the_edit_link_for_the_release_date(_step):
    button_css = 'div.section-published-date a.edit-release-date'
    world.css_click(button_css)


@step('I set the section release date to ([0-9/-]+)( [0-9:]+)?')
def set_section_release_date(_step, datestring, timestring):
    if hasattr(timestring, "strip"):
        timestring = timestring.strip()
    if not timestring:
        timestring = "00:00"
    set_date_and_time(
        'input.start-date.date.hasDatepicker', datestring,
        'input.start-time.time.ui-timepicker-input', timestring)
    world.browser.click_link_by_text('Save')


@step('I see a "(saving|deleting)" notification')
def i_see_a_mini_notification(_step, _type):
    saving_css = '.wrapper-notification-mini'
    assert world.is_css_present(saving_css)


@step('I see my section on the Courseware page$')
def i_see_my_section_on_the_courseware_page(_step):
    see_my_section_on_the_courseware_page('My Section')


@step('I see my section name with a quote on the Courseware page$')
def i_see_my_section_name_with_quote_on_the_courseware_page(_step):
    see_my_section_on_the_courseware_page('Section with "Quote"')


@step('I click to edit the section name$')
def i_click_to_edit_section_name(_step):
    world.css_click('span.section-name-span')


@step('I click on section name in Section Release Date modal$')
def i_click_on_section_name_in_modal(_step):
    world.css_click('.modal-window .section-name')


@step('I see no form for editing section name in modal$')
def edit_section_name_form_not_exist(_step):
    assert not world.is_css_present('.modal-window .section-name input')


@step('I see the complete section name with a quote in the editor$')
def i_see_complete_section_name_with_quote_in_editor(_step):
    css = '.section-name-edit input[type=text]'
    assert world.is_css_present(css)
    assert_equal(world.css_value(css), 'Section with "Quote"')


@step('the section does not exist$')
def section_does_not_exist(_step):
    css = 'h3[data-name="My Section"]'
    assert world.is_css_not_present(css)


@step('I see a release date for my section$')
def i_see_a_release_date_for_my_section(_step):
    import re

    css = 'span.published-status'
    assert world.is_css_present(css)
    status_text = world.css_text(css)<commit_msg>Speed up test by fixing negative assertion<commit_after># pylint: disable=C0111
# pylint: disable=W0621

from lettuce import world, step
from common import *
from nose.tools import assert_equal  # pylint: disable=E0611


@step('I click the New Section link$')
def i_click_new_section_link(_step):
    link_css = 'a.new-courseware-section-button'
    world.css_click(link_css)


@step('I enter the section name and click save$')
def i_save_section_name(_step):
    save_section_name('My Section')


@step('I enter a section name with a quote and click save$')
def i_save_section_name_with_quote(_step):
    save_section_name('Section with "Quote"')


@step('I have added a new section$')
def i_have_added_new_section(_step):
    add_section()


@step('I click the Edit link for the release date$')
def i_click_the_edit_link_for_the_release_date(_step):
    button_css = 'div.section-published-date a.edit-release-date'
    world.css_click(button_css)


@step('I set the section release date to ([0-9/-]+)( [0-9:]+)?')
def set_section_release_date(_step, datestring, timestring):
    if hasattr(timestring, "strip"):
        timestring = timestring.strip()
    if not timestring:
        timestring = "00:00"
    set_date_and_time(
        'input.start-date.date.hasDatepicker', datestring,
        'input.start-time.time.ui-timepicker-input', timestring)
    world.browser.click_link_by_text('Save')


@step('I see a "(saving|deleting)" notification')
def i_see_a_mini_notification(_step, _type):
    saving_css = '.wrapper-notification-mini'
    assert world.is_css_present(saving_css)


@step('I see my section on the Courseware page$')
def i_see_my_section_on_the_courseware_page(_step):
    see_my_section_on_the_courseware_page('My Section')


@step('I see my section name with a quote on the Courseware page$')
def i_see_my_section_name_with_quote_on_the_courseware_page(_step):
    see_my_section_on_the_courseware_page('Section with "Quote"')


@step('I click to edit the section name$')
def i_click_to_edit_section_name(_step):
    world.css_click('span.section-name-span')


@step('I click on section name in Section Release Date modal$')
def i_click_on_section_name_in_modal(_step):
    world.css_click('.modal-window .section-name')


@step('I see no form for editing section name in modal$')
def edit_section_name_form_not_exist(_step):
    assert world.is_css_not_present('.modal-window .section-name input')


@step('I see the complete section name with a quote in the editor$')
def i_see_complete_section_name_with_quote_in_editor(_step):
    css = '.section-name-edit input[type=text]'
    assert world.is_css_present(css)
    assert_equal(world.css_value(css), 'Section with "Quote"')


@step('the section does not exist$')
def section_does_not_exist(_step):
    css = 'h3[data-name="My Section"]'
    assert world.is_css_not_present(css)


@step('I see a release date for my section$')
def i_see_a_release_date_for_my_section(_step):
    import re

    css = 'span.published-status'
    assert world.is_css_present(css)
    status_text = world.css_text(css)
{'fraction_non_alphanumeric': 0.11011272667864729, 'fraction_numerical': 0.006861623917660513, 'mean_word_length': 5.221544715447155, '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': '1452586', 'n_tokens_mistral': 2141, 'n_tokens_neox': 2064, 'n_words': 496}