def testPopManyHeterogenous(self): l = FlexList([CharObject(u'm'), IntObject(5)]) result = l.call(u"pop", []) self.assertEqual(result.getInt(), 5)
def testPutSize(self): l = FlexList([IntObject(5), CharObject(u'a')]) l.put(1, IntObject(7)) expected = [IntObject(5), IntObject(7)] self.assertEqual(l.strategy.size(l), len(expected))
def testPopMany(self): l = FlexList([IntObject(42), IntObject(5)]) result = l.call(u"pop", []) self.assertEqual(result.getInt(), 5)
def testToStringMany(self): l = FlexList([IntObject(5), IntObject(42)]) self.assertEqual(l.toString(), u"[5, 42].diverge()")
def testContains(self): l = FlexList([IntObject(5), CharObject(u'a')]) self.assertTrue(l.contains(IntObject(5))) self.assertFalse(l.contains(IntObject(42))) self.assertFalse(l.contains(l))
def testToStringEmpty(self): l = FlexList([]) self.assertEqual(l.toString(), u"[].diverge()")
def testToStringOne(self): l = FlexList([IntObject(42)]) self.assertEqual(l.toString(), u"[42].diverge()")