re question - finiding matching ()

Jeff Epler jepler at unpythonic.net
Sun Jan 18 19:13:31 CET 2004


Perhaps you'd like to enhance your test-suite:
	# Do improperly-nested parens cause an exception? (part 1)
        text = 'add((1,2,3)'
        self.assertRaises(RuntimeError, findOperands, 'add', text)

	# Do improperly-nested parens cause an exception? (part 2)
        text = 'add(1,2,3))'
        self.assertRaises(RuntimeError, findOperands, 'add', text)

	# Do multiple statements on one line behave as expected?
        text = 'add(1,2); add(1,2)'
        expected = ['2', '3']
        self.assertEquals(operands, expected)

Jeff




More information about the Python-list mailing list