<commit_before>import datetime

import pandas as pd
import pytz

from pandas_market_calendars.exchange_calendar_sse import SSEExchangeCalendar
from pandas_market_calendars.holidays_cn import all_holidays


def test_time_zone():
    assert SSEExchangeCalendar().tz == pytz.timezone('Asia/Shanghai')
    assert SSEExchangeCalendar().name == 'SSE'


def test_all_holidays():
    sse_calendar = SSEExchangeCalendar()

    trading_days = sse_calendar.valid_days(pd.Timestamp('2004-01-01'), pd.Timestamp('2020-12-31'))
    for session_label in all_holidays:
        assert session_label.tz_localize("UTC") not in trading_days


def test_sse_closes_at_lunch():
    sse_calendar = SSEExchangeCalendar()
    sse_schedule = sse_calendar.schedule(
        start_date=datetime.datetime(2015, 1, 14, tzinfo=pytz.timezone('Asia/Shanghai')),
        end_date=datetime.datetime(2015, 1, 16, tzinfo=pytz.timezone('Asia/Shanghai'))
    )

    assert sse_calendar.open_at_time(
        schedule=sse_schedule,
        timestamp=datetime.datetime(2015, 1, 14, 11, 0, tzinfo=pytz.timezone('Asia/Shanghai'))
    )

    assert not sse_calendar.open_at_time(
        schedule=sse_schedule,
        timestamp=datetime.datetime(2015, 1, 14, 12, 0, tzinfo=pytz.timezone('Asia/Shanghai'))
    )
<commit_msg>More test coverage for cn holidays<commit_after>import datetime

import pandas as pd
import pytz

from pandas_market_calendars.exchange_calendar_sse import SSEExchangeCalendar
from pandas_market_calendars.holidays_cn import all_holidays


def test_time_zone():
    assert SSEExchangeCalendar().tz == pytz.timezone('Asia/Shanghai')
    assert SSEExchangeCalendar().name == 'SSE'


def test_all_holidays():
    sse_calendar = SSEExchangeCalendar()

    trading_days = sse_calendar.valid_days(pd.Timestamp('2004-01-01'), pd.Timestamp('2022-12-31'))
    for session_label in all_holidays:
        assert session_label.tz_localize("UTC") not in trading_days

    holidays = [
        '2019-05-03', '2020-01-31', '2021-02-15', '2022-05-04',
    ]
    for date in holidays:
        assert pd.Timestamp(date, tz='UTC') not in trading_days


def test_sse_closes_at_lunch():
    sse_calendar = SSEExchangeCalendar()
    sse_schedule = sse_calendar.schedule(
        start_date=datetime.datetime(2015, 1, 14, tzinfo=pytz.timezone('Asia/Shanghai')),
        end_date=datetime.datetime(2015, 1, 16, tzinfo=pytz.timezone('Asia/Shanghai'))
    )

    assert sse_calendar.open_at_time(
        schedule=sse_schedule,
        timestamp=datetime.datetime(2015, 1, 14, 11, 0, tzinfo=pytz.timezone('Asia/Shanghai'))
    )

    assert not sse_calendar.open_at_time(
        schedule=sse_schedule,
        timestamp=datetime.datetime(2015, 1, 14, 12, 0, tzinfo=pytz.timezone('Asia/Shanghai'))
    )

{'fraction_non_alphanumeric': 0.11143375680580762, 'fraction_numerical': 0.047912885662431945, 'mean_word_length': 4.361867704280155, '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': '1177373', 'n_tokens_mistral': 1068, 'n_tokens_neox': 940, 'n_words': 166}