"""Held-out tests for duration.py: do NOT give this file to the AI. Run it yourself after
the visible tests pass: python3 -m unittest test_duration_extra.py"""
import unittest

from duration import parse_duration


class ParseDurationExtraTest(unittest.TestCase):
    def test_zero_parts(self):
        self.assertEqual(parse_duration("0s"), 0)
        self.assertEqual(parse_duration("0h0m0s"), 0)

    def test_leading_zeros(self):
        self.assertEqual(parse_duration("01m05s"), 65)

    def test_hours_and_seconds_without_minutes(self):
        self.assertEqual(parse_duration("1h10s"), 3610)

    def test_more_invalid(self):
        for bad in ["m5", "5ms", "1h 1h", "s", "+5s", "5s5", "1h,5m", "1d", "١٢s", "86401s"]:
            with self.subTest(text=bad):
                with self.assertRaises(ValueError):
                    parse_duration(bad)

    def test_not_a_bool_or_float(self):
        self.assertIs(type(parse_duration("5s")), int)


if __name__ == "__main__":
    unittest.main()
