[Bioperl-l] tests failing badly

Hilmar Lapp hlapp@gnf.org
Mon, 9 Sep 2002 22:47:44 -0700


On Monday, September 9, 2002, at 09:26  PM, Aaron J Mackey wrote:

>
> In fact, in reversing my changes to Bio::Factory::FTLocationFactory,
> you've messed up things.  Here's what you have:
>
>     $start =~ s/^\((.*)\)$/$1/;
>     $end   =~ s/^\((.*)\)$/$1/ if $end;
>
> This requires that start and end have *both* begin and end parentheses.

donau: bioperl-live 22:38 281>perl -e '$a = "200"; $a =~ 
s/^\((.*)\)$/$1/; print "$a\n";'
200
donau: bioperl-live 22:38 282>

What does your perl say? I've tested this on other systems than my 
own and it always worked. I'd be surprised if the regexp 
substitution behaviour has changed that substantially. If the 
expression is not matched, simply no substitution takes place -- 
which is exactly what I want here.

> With this code, I get lots of:
>
> Argument "202)" isn't numeric in numeric gt (>) at 
> blib/lib/Bio/Location/Atomic.pm line 91, <GEN4> line 35.
> Argument "(100" isn't numeric in numeric gt (>) at 
> blib/lib/Bio/Location/Atomic.pm line 91, <GEN4> line 35.
> Argument "202)" isn't numeric in numeric gt
> [...]

Using the tests in t/* ? I don't see that. Which perl version do you 
run? This is really weird. Which OS?

>
> With my patch:
>
>     $start =~ s/^\(?(.*?)\)?/$1/;
>     $end   =~ s/\(?(.*?)\)?$/$1/ if $end;
>
> All tests pass cleanly.  What's the issue here?

The first regexp gets (203.225) wrong: it doesn't remove the 
trailing parenthesis.

Also, disabling greediness and the optional chars make the regexp 
supposedly slower (as more backtracking is necessary), and honestly 
it's less readable too. After the previous mess in FTHelper I'm 
determined to keep those regexp the least complex and fancy that is 
absolutely necessary.


>   Yes, when you mistakenly
> set a Location's start to "202)" it turns into 202, but what's 
> wrong with
> having tests (and behavior) operate without spurious warnings?  Is 
> this a
> difference in your version of Perl and mine?
>

Maybe. It's really strange.

	-hilmar
--
-------------------------------------------------------------
Hilmar Lapp                            email: lapp at gnf.org
GNF, San Diego, Ca. 92121              phone: +1-858-812-1757
-------------------------------------------------------------