def test_last_without_change(self): inst = ContentFilters([('first', 'first')]) _before = copy(inst.filters) result = inst.last() _after = inst.filters assert _before == _after self.assertEqual(('first', 'first'), result)
def test_first_with_change(self): inst = ContentFilters([('first', 'first')]) _before = copy(inst.filters) result = inst.first(True) _after = inst.filters assert len(_before) > len(_after) self.assertEqual(('first', 'first'), result)
def test_depth(self): inst = ContentFilters([('first', 'first')]) self.assertEqual(inst.depth(), 1)
def test_yield_values(self): inst = ContentFilters([('first', 'first')]) _temp = [] for i in inst.all(): _temp.append(i) self.assertEqual([('first', 'first')], _temp)
def test_adding_values(self): inst = ContentFilters([('first', 'first')]) inst + (('attr', 'second')) self.assertEqual(inst.last(), ('attr', 'second'))
def test_initiation_success(self): inst = ContentFilters([('first', 'first')]) self.assertEqual(inst.first(), ('first', 'first'))
def test_initiation_fail(self): inst = ContentFilters('sample') self.assertEqual(inst.filters, 'sample')