Add automatic update checks

This commit is contained in:
sunguosheng
2026-06-17 21:07:04 +08:00
parent 26265cbb10
commit 692a31303e
7 changed files with 193 additions and 2 deletions
+18
View File
@@ -0,0 +1,18 @@
import unittest
from nlprog.updater import VERSION_RE, _version_tuple
class UpdaterTests(unittest.TestCase):
def test_version_regex_reads_pyproject_version(self):
match = VERSION_RE.search('[project]\nname = "nlprog"\nversion = "0.2.0"\n')
self.assertIsNotNone(match)
self.assertEqual(match.group(1), "0.2.0")
def test_version_tuple_compares_numeric_versions(self):
self.assertGreater(_version_tuple("0.10.0"), _version_tuple("0.2.0"))
self.assertEqual(_version_tuple("1.2.3"), (1, 2, 3))
if __name__ == "__main__":
unittest.main()