# Path: app/note_util.py
# MARKDOWN_EXTRAS = [
#     'code-friendly',
#     'fenced-code-blocks',
#     'smarty-pants',
#     'tables',
# ]
# TIMEZONE = ZoneInfo(os.environ['DISPLAY_TIMEZONE'])
# NOTES_DIRECTORY = 'notes'
# REFERENCE_DIRECTORY = 'reference'
# class Note(object):
#     def __init__(self) -> None:
#     def __eq__(self, other: Any) -> bool:
#     def __repr__(self) -> str:
#     def get_note_file_data(note_file: str) -> Optional["Note"]:
#     def parse_time(timestamp_str: str) -> datetime.datetime:
#     def parse_markdown(markdown: str) -> str:
#     def write_note(self) -> None:
# def prune_note_files(note_files: List[str]) -> List[str]:
#     def is_valid_note(note_file: str) -> bool:
# def get_note_files(directory: str) -> List[str]:
# def get_notes(directory: str) -> List[Note]:
# def get_note_from_slug(directory: str, slug: str) -> Optional[Note]:
# 
# Path: app/serve.py
#     def init_rollbar() -> None:
# def inject_envs() -> Dict[str, Any]:
# def robots() -> Any:
# def health() -> Any:
# def page_not_found(e: Exception) -> Any:


import datetime
import json
import os
import re
import tempfile
import unittest
import requests
from typing import Any, Callable, cast
from titlecase import titlecase
from varsnap import test
from app import note_util, serve


def make_check_slug(note: note_util.Note) -> Callable[..., None]:
    def test(self: Any) -> None:
        self.check_slug(note)
    return test


first = True
notes = note_util.get_notes(note_util.NOTES_DIRECTORY) + \
        note_util.get_notes(note_util.NOTES_DIRECTORY)
for note in note_util.get_notes(note_util.NOTES_DIRECTORY):
    delta = datetime.datetime.now(tz=note_util.TIMEZONE) - note.time
    if delta <= datetime.timedelta(days=30) or first:
        test_func = make_check_grammar(note)
        setattr(TestGrammar, 'test_%s' % note.slug, test_func)
        first = False
    test_func = make_check_style(note)
    setattr(TestStyle, 'test_%s' % note.slug, test_func)
    test_func = make_check_page(note_util.NOTES_DIRECTORY, note)
    setattr(TestPage, 'test_%s' % note.slug, test_func)
for note in note_util.get_notes(note_util.REFERENCE_DIRECTORY):
    test_func = make_check_page(note_util.REFERENCE_DIRECTORY, note)
    setattr(TestPage, 'test_%s' % note.slug, test_func)
    test_func = make_check_slug(note)
    setattr(TestSlug, 'test_%s' % note.slug, test_func)


class TestIntegration(unittest.TestCase):
    def test_varsnap(self) -> None:

# Path: app/note_util.py
# MARKDOWN_EXTRAS = [
#     'code-friendly',
#     'fenced-code-blocks',
#     'smarty-pants',
#     'tables',
# ]
# TIMEZONE = ZoneInfo(os.environ['DISPLAY_TIMEZONE'])
# NOTES_DIRECTORY = 'notes'
# REFERENCE_DIRECTORY = 'reference'
# class Note(object):
#     def __init__(self) -> None:
#     def __eq__(self, other: Any) -> bool:
#     def __repr__(self) -> str:
#     def get_note_file_data(note_file: str) -> Optional["Note"]:
#     def parse_time(timestamp_str: str) -> datetime.datetime:
#     def parse_markdown(markdown: str) -> str:
#     def write_note(self) -> None:
# def prune_note_files(note_files: List[str]) -> List[str]:
#     def is_valid_note(note_file: str) -> bool:
# def get_note_files(directory: str) -> List[str]:
# def get_notes(directory: str) -> List[Note]:
# def get_note_from_slug(directory: str, slug: str) -> Optional[Note]:
# 
# Path: app/serve.py
#     def init_rollbar() -> None:
# def inject_envs() -> Dict[str, Any]:
# def robots() -> Any:
# def health() -> Any:
# def page_not_found(e: Exception) -> Any:


# Path: app/tests/test_note.py
import datetime
import json
import os
import re
import tempfile
import unittest
import requests
from typing import Any, Callable, cast
from titlecase import titlecase
from varsnap import test
from app import note_util, serve



def make_check_slug(note: note_util.Note) -> Callable[..., None]:
    def test(self: Any) -> None:
        self.check_slug(note)
    return test


first = True
notes = note_util.get_notes(note_util.NOTES_DIRECTORY) + \
        note_util.get_notes(note_util.NOTES_DIRECTORY)
for note in note_util.get_notes(note_util.NOTES_DIRECTORY):
    delta = datetime.datetime.now(tz=note_util.TIMEZONE) - note.time
    if delta <= datetime.timedelta(days=30) or first:
        test_func = make_check_grammar(note)
        setattr(TestGrammar, 'test_%s' % note.slug, test_func)
        first = False
    test_func = make_check_style(note)
    setattr(TestStyle, 'test_%s' % note.slug, test_func)
    test_func = make_check_page(note_util.NOTES_DIRECTORY, note)
    setattr(TestPage, 'test_%s' % note.slug, test_func)
for note in note_util.get_notes(note_util.REFERENCE_DIRECTORY):
    test_func = make_check_page(note_util.REFERENCE_DIRECTORY, note)
    setattr(TestPage, 'test_%s' % note.slug, test_func)
    test_func = make_check_slug(note)
    setattr(TestSlug, 'test_%s' % note.slug, test_func)


class TestIntegration(unittest.TestCase):
    def test_varsnap(self) -> None:

        with serve.app.test_request_context(