pre-commit/pre_commit/commands
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
..
__init__.py Move commands into their own files. 2014-06-13 19:52:14 -07:00
autoupdate.py Restore git 1.8 support 2018-03-12 14:36:07 -07:00
clean.py Adhere to XDG specification for cache dir. 2017-09-06 10:00:35 -07:00
install_uninstall.py Refuse to install with core.hooksPath set 2018-03-03 15:24:14 -08:00
migrate_config.py Migrate sha -> rev 2018-02-24 20:19:39 -08:00
run.py Add tests for _filter_by_types 2018-05-03 11:46:07 +01:00
sample_config.py Migrate sha -> rev 2018-02-24 20:19:39 -08:00
try_repo.py Migrate sha -> rev 2018-02-24 20:19:39 -08:00