pre-commit/pre_commit
Zander Hill 29d66f470d Add tests for _filter_by_types
Adds a test for python and bash `types` using identify per interpreter
interpretation.

The python test succeeds with a false positive. The bash test identifies
the bug, where a comparison happens between `tags >= types`.

Tags is the tag list from identify, types is the value passed in from
configuration file as `acceptable types`.

The `tags(List) >= types(FrozenSet)` does a sort comparison of the two sequences
as evidenced by this code sample (which should return True):

```
>>> types = frozenset(['a'])
>>> tags = ['bash']
>>> tags >= types
True
```

Note: In 2.7, I cannot get this to return anything other than True.
Including the empty case:
```
>>> [] > frozenset()
True
```

Which means to me that a list is always >= a frozenset in Python 2.7.

In Python 3.5, I see errors when comparing a List to a FrozenSet. So
thankfully the interpreter is stricter in this case.

```
>>> [] >= frozenset()
TypeError: unorderable types: list() >= frozenset()
```
2018-05-03 11:46:07 +01:00
..
commands Add tests for _filter_by_types 2018-05-03 11:46:07 +01:00
languages Fix go 1.10: no pkg dir 2018-03-12 14:02:34 -07:00
meta_hooks Move pre_commit.schema to cfgv library 2018-02-18 15:25:53 -08:00
resources Rewrite the hook template in python 2018-02-03 22:51:00 -08:00
__init__.py Initial commit. 2014-03-12 20:25:19 -07:00
__main__.py Runnable as python -m pre_commit 2014-07-22 19:22:29 -07:00
clientlib.py Add a manual stage for cli-only interaction 2018-03-07 12:41:25 -08:00
color.py Small cleanups 2017-09-30 15:53:44 -07:00
color_windows.py Small cleanups 2017-09-30 15:53:44 -07:00
constants.py Add a manual stage for cli-only interaction 2018-03-07 12:41:25 -08:00
envcontext.py Small cleanups 2017-09-30 15:53:44 -07:00
error_handler.py Small cleanups 2017-09-30 15:53:44 -07:00
file_lock.py Small cleanups 2017-09-30 15:53:44 -07:00
five.py Small cleanups 2017-09-30 15:53:44 -07:00
git.py Migrate sha -> rev 2018-02-24 20:19:39 -08:00
logging_handler.py Small cleanups 2017-09-30 15:53:44 -07:00
main.py Add a manual stage for cli-only interaction 2018-03-07 12:41:25 -08:00
make_archives.py Restore git 1.8 support 2018-03-12 14:36:07 -07:00
output.py Use asottile/add-trailing-comma 2017-07-12 18:30:51 -07:00
parse_shebang.py https-ify links 2018-01-13 18:17:54 -08:00
prefix.py Simplify prefix a bit 2018-01-13 16:08:18 -08:00
repository.py Migrate sha -> rev 2018-02-24 20:19:39 -08:00
runner.py Lazily install repositories 2017-10-20 13:04:33 -07:00
staged_files_only.py Do not crash in staged_files_only if patch_dir does not exist 2017-09-17 15:22:48 -07:00
store.py Fix regression: try-repo from relative path 2018-03-17 20:02:06 -07:00
util.py Remove unused __popen DI 2018-05-02 11:25:16 -04:00
xargs.py xargs returns nonzero for negate + not found exe (fixes pcre + not found #447) 2016-12-04 15:07:35 -08:00