(self)
| 2985 | self.assertEqual(new_contents, orig_contents) |
| 2986 | |
| 2987 | def test_no_change(self): |
| 2988 | # bpo-42398: Test that the destination file is left unchanged if the |
| 2989 | # content does not change. Moreover, check also that the file |
| 2990 | # modification time does not change in this case. |
| 2991 | code = dedent(""" |
| 2992 | /*[clinic input] |
| 2993 | [clinic start generated code]*/ |
| 2994 | /*[clinic end generated code: output=da39a3ee5e6b4b0d input=da39a3ee5e6b4b0d]*/ |
| 2995 | """) |
| 2996 | with os_helper.temp_dir() as tmp_dir: |
| 2997 | fn = os.path.join(tmp_dir, "test.c") |
| 2998 | with open(fn, "w", encoding="utf-8") as f: |
| 2999 | f.write(code) |
| 3000 | pre_mtime = os.stat(fn).st_mtime_ns |
| 3001 | self.expect_success(fn) |
| 3002 | post_mtime = os.stat(fn).st_mtime_ns |
| 3003 | # Don't change the file modification time |
| 3004 | # if the content does not change |
| 3005 | self.assertEqual(pre_mtime, post_mtime) |
| 3006 | |
| 3007 | def test_cli_force(self): |
| 3008 | invalid_input = dedent(""" |
nothing calls this directly
no test coverage detected