fix: stabilize agent file change previews
This commit is contained in:
@@ -2,7 +2,10 @@ from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
|
||||
from scripts.generate_flutter_license_triage import candidate_license
|
||||
from scripts.generate_flutter_license_triage import (
|
||||
candidate_license,
|
||||
license_signatures,
|
||||
)
|
||||
|
||||
|
||||
class FlutterLicenseTriageTests(unittest.TestCase):
|
||||
@@ -16,9 +19,26 @@ class FlutterLicenseTriageTests(unittest.TestCase):
|
||||
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])
|
||||
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])
|
||||
self.assertEqual(
|
||||
sorted(license_signatures(mixed)),
|
||||
["Apache-2.0", "MPL-2.0"],
|
||||
)
|
||||
|
||||
def test_detects_license_signatures_in_composite_notice(self) -> None:
|
||||
text = """Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met. Neither the name of the project
|
||||
may be used to endorse products. THIS SOFTWARE IS PROVIDED AS IS; DISCLAIMER.
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
"""
|
||||
signatures = license_signatures(text)
|
||||
self.assertEqual(sorted(signatures), ["Apache-2.0", "BSD-3-Clause"])
|
||||
self.assertIsNone(candidate_license(text)[0])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user