[pypy-dev] utest conversion
jacob at strakt.com
Tue Jun 15 19:14:34 CEST 2004
On tisdag 15 juni 2004 19.06, holger krekel wrote:
> [Armin Rigo Tue, Jun 15, 2004 at 05:56:07PM +0100]
> > Hi,
> > Building on a suggestion by Jacob on how to safely convert old-style
> > unittests "self.assertEquals(x,y)" into new-style utest "assert x == y":
> > the difficulty is not to find the self.assertEquals() in the test
> > sources, but to safely identify the comma between the two arguments, and
> > not mistake it with some other comma that could appear in x or in y.
> > There was talk about subtle string parsing, or about using Python's
> > parser or compiler package, but actually it is much easier than that...
> > Just try to split the text "x,y" between the parenthesis in two halves at
> > every possible comma position, until both halves compile without raising
> > SyntaxError :-)
> Yes, that reminds me of my favourite "try-parsing" technique (used
> in rlcompleter2 and elsewhere :-)
> Actually you also need to check for multiline-parseability first. IIRC
> we do have a quite a bit of multiline-asserts.
Laura has solved the try-parsing problem, so it isn't just a suggestion any
More information about the Pypy-dev