test_datatypefilter.py
27 lines
| 1001 B
| text/x-python
|
PythonLexer
MinRK
|
r18589 | """Module with tests for DataTypeFilter""" | ||
Jonathan Frederic
|
r11481 | |||
MinRK
|
r18589 | # Copyright (c) IPython Development Team. | ||
Jonathan Frederic
|
r11481 | # Distributed under the terms of the Modified BSD License. | ||
from ...tests.base import TestsBase | ||||
from ..datatypefilter import DataTypeFilter | ||||
Jonathan Frederic
|
r11494 | class TestDataTypeFilter(TestsBase): | ||
Jonathan Frederic
|
r11481 | """Contains test functions for datatypefilter.py""" | ||
def test_constructor(self): | ||||
"""Can an instance of a DataTypeFilter be created?""" | ||||
DataTypeFilter() | ||||
def test_junk_types(self): | ||||
"""Can the DataTypeFilter pickout a useful type from a list of junk types?""" | ||||
filter = DataTypeFilter() | ||||
MinRK
|
r18589 | assert "image/png" in filter(["hair", "water", "image/png", "rock"]) | ||
MinRK
|
r15383 | assert "application/pdf" in filter(["application/pdf", "hair", "water", "png", "rock"]) | ||
Jonathan Frederic
|
r11936 | self.assertEqual(filter(["hair", "water", "rock"]), []) | ||
Jonathan Frederic
|
r11481 | |||
def test_null(self): | ||||
"""Will the DataTypeFilter fail if no types are passed in?""" | ||||
filter = DataTypeFilter() | ||||
Jonathan Frederic
|
r11936 | self.assertEqual(filter([]), []) | ||