def testOtherReversal(self): '''Collector << OtherObjectType # libother << operator''' collector = Collector() obj = OtherObjectType() collector << obj self.assertEqual(collector.items()[0], obj.identifier() * 2)
def testLShiftWithExpectedType(self): '''Collector << ObjectType # libsample << operator''' collector = Collector() obj = ObjectType() collector << obj self.assertEqual(collector.items()[0], obj.identifier())
def testBasic(self): '''Collector << ObjectType # greedy collector''' collector = Collector() obj = ObjectType() collector << obj self.assertEqual(collector.items()[0], obj.identifier())
def testLShiftOperatorMultipleUses(self): '''Test case for using the Collector.__lshift__ operator many times in the same line.''' collector = Collector() collector << 2 << 3 << 5 << 7 << 11 self.assertEqual(collector.size(), 5) self.assertEqual(collector.items(), [2, 3, 5, 7, 11])
def testLShiftExternal(self): '''Collector external operator''' collector = Collector() collector << IntWrapper(5) self.assertEqual(collector.size(), 1) self.assertEqual(collector.items(), [5])
def testLShiftOperatorSingleUse(self): '''Test case for using the Collector.__lshift__ operator just one time.''' collector = Collector() collector << 13 self.assertEqual(collector.size(), 1) self.assertEqual(collector.items(), [13])