Anthony Sottile | 8f61529 | 2022-01-15 19:24:05 -0500 | [diff] [blame] | 1 | from __future__ import annotations |
| 2 | |
Anthony Sottile | 030bfac | 2019-01-31 19:19:10 -0800 | [diff] [blame] | 3 | from pre_commit_hooks.check_ast import main |
Anthony Sottile | 8a8aaf5 | 2015-08-04 13:45:41 -0700 | [diff] [blame] | 4 | from testing.util import get_resource_path |
| 5 | |
| 6 | |
| 7 | def test_failing_file(): |
Anthony Sottile | 030bfac | 2019-01-31 19:19:10 -0800 | [diff] [blame] | 8 | ret = main([get_resource_path('cannot_parse_ast.notpy')]) |
Anthony Sottile | 8a8aaf5 | 2015-08-04 13:45:41 -0700 | [diff] [blame] | 9 | assert ret == 1 |
| 10 | |
| 11 | |
| 12 | def test_passing_file(): |
Anthony Sottile | 030bfac | 2019-01-31 19:19:10 -0800 | [diff] [blame] | 13 | ret = main([__file__]) |
Anthony Sottile | 8a8aaf5 | 2015-08-04 13:45:41 -0700 | [diff] [blame] | 14 | assert ret == 0 |