# -*- coding: utf-8 -*-
from datetime import datetime
from pathlib import Path
import torch
import pytest

from . import check_bad_imports


current_assignment = pytest.mark.skipif(
    not (datetime(2025, 10, 30) <= datetime.now() <= datetime(2025, 11, 5, 23, 59, 59)),
    reason="This is not the current assignment.",
)


@current_assignment
def test_no_abs_import():
    paths = list(Path().glob("mmp/a3/*.py"))
    check_bad_imports(paths)


@current_assignment
def test_dataset():
    from mmp.a3 import dataset

    assert issubclass(dataset.MMP_Dataset, torch.utils.data.Dataset)


@current_assignment
def test_annotation():
    from mmp.a3 import annotation

    rect = annotation.AnnotationRect(x1=3, y1=2, x2=40, y2=50)
    assert rect.x1 == 3
    assert rect.y1 == 2
    assert rect.x2 == 40
    assert rect.y2 == 50
    rect = annotation.AnnotationRect(x1=3, y1=2, x2=40, y2=50)
    assert rect.x1 == 3
    assert rect.y1 == 2
    assert rect.x2 == 40
    assert rect.y2 == 50


@current_assignment
def test_main():
    from mmp.a3 import main

    main.main
