예제 #1
0
 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)
예제 #2
0
 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)
예제 #3
0
 def test_depth(self):
     inst = ContentFilters([('first', 'first')])
     self.assertEqual(inst.depth(), 1)
예제 #4
0
 def test_yield_values(self):
     inst = ContentFilters([('first', 'first')])
     _temp = []
     for i in inst.all():
         _temp.append(i)
     self.assertEqual([('first', 'first')], _temp)
예제 #5
0
 def test_adding_values(self):
     inst = ContentFilters([('first', 'first')])
     inst + (('attr', 'second'))
     self.assertEqual(inst.last(), ('attr', 'second'))
예제 #6
0
 def test_initiation_success(self):
     inst = ContentFilters([('first', 'first')])
     self.assertEqual(inst.first(), ('first', 'first'))
예제 #7
0
 def test_initiation_fail(self):
     inst = ContentFilters('sample')
     self.assertEqual(inst.filters, 'sample')