File: test_release_notes.py

package info (click to toggle)
pytorch-cuda 2.6.0%2Bdfsg-7
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid, trixie
  • size: 161,620 kB
  • sloc: python: 1,278,832; cpp: 900,322; ansic: 82,710; asm: 7,754; java: 3,363; sh: 2,811; javascript: 2,443; makefile: 597; ruby: 195; xml: 84; objc: 68
file content (55 lines) | stat: -rw-r--r-- 2,235 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import tempfile
import unittest

from commitlist import CommitList


class TestCommitList(unittest.TestCase):
    def test_create_new(self):
        with tempfile.TemporaryDirectory() as tempdir:
            commit_list_path = f"{tempdir}/commitlist.csv"
            commit_list = CommitList.create_new(
                commit_list_path, "v1.5.0", "6000dca5df"
            )
            self.assertEqual(len(commit_list.commits), 33)
            self.assertEqual(commit_list.commits[0].commit_hash, "7335f079abb")
            self.assertTrue(
                commit_list.commits[0].title.startswith("[pt][quant] qmul and qadd")
            )
            self.assertEqual(commit_list.commits[-1].commit_hash, "6000dca5df6")
            self.assertTrue(
                commit_list.commits[-1].title.startswith(
                    "[nomnigraph] Copy device option when customize "
                )
            )

    def test_read_write(self):
        with tempfile.TemporaryDirectory() as tempdir:
            commit_list_path = f"{tempdir}/commitlist.csv"
            initial = CommitList.create_new(commit_list_path, "v1.5.0", "7543e7e558")
            initial.write_to_disk()

            expected = CommitList.from_existing(commit_list_path)
            expected.commits[-2].category = "foobar"
            expected.write_to_disk()

            commit_list = CommitList.from_existing(commit_list_path)
            for commit, expected_commit in zip(commit_list.commits, expected.commits):
                self.assertEqual(commit, expected_commit)

    def test_update_to(self):
        with tempfile.TemporaryDirectory() as tempdir:
            commit_list_path = f"{tempdir}/commitlist.csv"
            initial = CommitList.create_new(commit_list_path, "v1.5.0", "7543e7e558")
            initial.commits[-2].category = "foobar"
            self.assertEqual(len(initial.commits), 2143)
            initial.write_to_disk()

            commit_list = CommitList.from_existing(commit_list_path)
            commit_list.update_to("5702a28b26")
            self.assertEqual(len(commit_list.commits), 2143 + 4)
            self.assertEqual(commit_list.commits[-5], initial.commits[-1])


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