diff options
author | David Robillard <d@drobilla.net> | 2023-05-05 12:35:46 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 18:49:08 -0500 |
commit | 439d6ec3d6dfbea74334beace790f500e61c9b7d (patch) | |
tree | e385755a7d557dd5eb6f33b841072375cfaca29d /test/serd_test_util/__init__.py | |
parent | c9afaab2a84f592e4567b37b3551511381e734e4 (diff) | |
download | serd-439d6ec3d6dfbea74334beace790f500e61c9b7d.tar.gz serd-439d6ec3d6dfbea74334beace790f500e61c9b7d.tar.bz2 serd-439d6ec3d6dfbea74334beace790f500e61c9b7d.zip |
Add statement filter sink and serd-filter tool
Diffstat (limited to 'test/serd_test_util/__init__.py')
-rw-r--r-- | test/serd_test_util/__init__.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/serd_test_util/__init__.py b/test/serd_test_util/__init__.py index 5f0e0033..a75bb2ae 100644 --- a/test/serd_test_util/__init__.py +++ b/test/serd_test_util/__init__.py @@ -182,3 +182,16 @@ def lines_equal(from_lines, to_lines, from_filename, to_filename): same = False return same + + +def file_equals(patha, pathb): + """Return true if the file at patha is the same as the file at pathb.""" + + for path in (patha, pathb): + if not os.access(path, os.F_OK): + error("missing file {}\n".format(path)) + return False + + with open(patha, "r", encoding="utf-8") as fa: + with open(pathb, "r", encoding="utf-8") as fb: + return lines_equal(fa.readlines(), fb.readlines(), patha, pathb) |