import importlib.util
from pathlib import Path
import unittest

spec = importlib.util.spec_from_file_location("demo", Path(__file__).with_name("cline-demo.py"))
assert spec is not None and spec.loader is not None
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)

class TotalTests(unittest.TestCase):
    def test_zero(self):
        self.assertEqual(module.total_cents(0, 0), 0)
    def test_regular(self):
        self.assertEqual(module.total_cents(125, 4), 500)
    def test_negative(self):
        for args in [(-1, 2), (1, -2)]:
            with self.assertRaises(ValueError): module.total_cents(*args)
    def test_fraction(self):
        for args in [(1.5, 2), (1, 2.5)]:
            with self.assertRaises(ValueError): module.total_cents(*args)
    def test_bool(self):
        for args in [(True, 2), (1, False)]:
            with self.assertRaises(ValueError): module.total_cents(*args)
    def test_overflow(self):
        with self.assertRaises(ValueError): module.total_cents(2**53-1, 2)

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