Files
sovereign_ai/SovereignAI-Starter/tests/test_flutter_license_triage.py
T

26 lines
1.3 KiB
Python

from __future__ import annotations
import unittest
from scripts.generate_flutter_license_triage import candidate_license
class FlutterLicenseTriageTests(unittest.TestCase):
def test_recognizes_common_license_text_signatures_conservatively(self) -> None:
mit = "Permission is hereby granted, free of charge, to any person. The Software is provided AS IS. In no event shall the authors be liable."
mpl = "Mozilla Public License Version 2.0"
bsd3 = "Redistribution and use in source and binary forms are permitted provided that the following conditions are met. Neither the name of the project nor the names of its contributors may be used to endorse products. THIS SOFTWARE IS PROVIDED AS IS; DISCLAIMER"
self.assertEqual(candidate_license(mit)[0], "MIT")
self.assertEqual(candidate_license(mpl)[0], "MPL-2.0")
self.assertEqual(candidate_license(bsd3)[0], "BSD-3-Clause")
def test_keeps_ambiguous_notice_unclassified(self) -> None:
self.assertIsNone(candidate_license("Copyright 2026 Example Authors. All rights reserved." )[0])
mixed = "Mozilla Public License Version 2.0. Apache License Version 2.0."
self.assertIsNone(candidate_license(mixed)[0])
if __name__ == "__main__":
unittest.main()