]> git.donarmstrong.com Git - biopieces.git/commitdiff
replaced option keys from strings to symbols in ruby code
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Wed, 1 Sep 2010 13:03:31 +0000 (13:03 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Wed, 1 Sep 2010 13:03:31 +0000 (13:03 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@1070 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/read_fasta
code_ruby/Maasha/lib/biopieces.rb
code_ruby/Maasha/test/test_biopieces.rb

index c0ab73f05642c5d585fc3a18e5fdfe92eeef59fe..c0f9426ea52183c8afeadc876c08cfa325c61218 100755 (executable)
@@ -46,14 +46,14 @@ end
 num  = 0
 last = false
 
-if options.has_key? 'data_in'
-  options['data_in'].each do |file|
+if options.has_key? :data_in
+  options[:data_in].each do |file|
     Fasta.open(file, mode='r') do |fasta|
       fasta.each do |entry|
         bp.puts entry.to_bp
         num += 1
 
-        if options.has_key? 'num' and options['num'] == num
+        if options.has_key? :num and options[:num] == num
           last = true
           break
         end
index 22c1b27eabd67e6f41bf03bad679aa6ace264b2b..bb510804892123504279814ac18d670ac7bce6a0 100644 (file)
@@ -35,7 +35,7 @@ require 'pp'
 # integrity of the casts are checked. Following the command line parsing, the
 # options are checked according to the casts. Methods are also included for handling
 # the parsing and emitting of Biopiece records, which are ASCII text records consisting
-# of lines with a key/value pair seperated by a colon and a white space ': '.
+# of lines with a key/value pair separated by a colon and a white space ': '.
 # Each record is separated by a line with three dashes '---'.
 class Biopieces
   # Initialize a Biopiece and write the status to file.
@@ -126,6 +126,7 @@ class Casts < Array
     @cast_list = cast_list
     ubiquitous
     check
+    long_to_sym
     self.push *@cast_list
   end
 
@@ -133,10 +134,10 @@ class Casts < Array
 
   # Add ubiquitous options casts.
   def ubiquitous
-    @cast_list << {:long => 'help',       :short => '?', :type => 'flag',   :mandatory => false, :default => nil, :allowed => nil, :disallowed => nil}
-    @cast_list << {:long => 'stream_in',  :short => 'I', :type => 'files!', :mandatory => false, :default => nil, :allowed => nil, :disallowed => nil}
-    @cast_list << {:long => 'stream_out', :short => 'O', :type => 'file',   :mandatory => false, :default => nil, :allowed => nil, :disallowed => nil}
-    @cast_list << {:long => 'verbose',    :short => 'v', :type => 'flag',   :mandatory => false, :default => nil, :allowed => nil, :disallowed => nil}
+    @cast_list << {:long=>'help',       :short=>'?', :type=>'flag',   :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
+    @cast_list << {:long=>'stream_in',  :short=>'I', :type=>'files!', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
+    @cast_list << {:long=>'stream_out', :short=>'O', :type=>'file',   :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
+    @cast_list << {:long=>'verbose',    :short=>'v', :type=>'flag',   :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
   end
 
   # Check integrity of the casts.
@@ -235,6 +236,14 @@ class Casts < Array
       check_hash[cast[:short]] = true
     end
   end
+
+  # Convert values to :long keys to symbols for all casts.
+  def long_to_sym
+    @cast_list.each do |cast|
+      cast[:long] = cast[:long].to_sym
+    end
+  end
+
 end
 
 
@@ -313,16 +322,16 @@ class OptionHandler
 
   # Check if full "usage info" should be printed.
   def print_usage_full?
-    @options["help"]
+    @options[:help]
   end
 
   # Check if short "usage info" should be printed.
   def print_usage_short?
     if not $stdin.tty?
       return false
-    elsif @options["stream_in"]
+    elsif @options[:stream_in]
       return false
-    elsif @options["data_in"]
+    elsif @options[:data_in]
       return false
     elsif wiki_path =~ /^(list_biopieces|list_genomes|list_mysql_databases|biostat)$/  # TODO get rid of this!
       return false
@@ -515,7 +524,7 @@ class Status
     command  = [script, args].join(" ") 
     log_file = ENV["BP_LOG"] + "/biopieces.log"
 
-    File.open(log_file, mode="a") { |file| file.puts [time0, time1, elap, user, exit_status, command].join("\t") }
+    File.open(log_file, mode = "a") { |file| file.puts [time0, time1, elap, user, exit_status, command].join("\t") }
   end
 
   # Delete status file.
@@ -542,13 +551,13 @@ end
 
 class Stream < IO
   # Open Biopieces output data stream for reading from stdin or a file
-  # specified in options["stream_in"] OR writing to stdout or a file
-  # specified in options["stream_out"].
+  # specified in options[:stream_in] OR writing to stdout or a file
+  # specified in options[:stream_out].
   def self.open(options, mode, stdio)
     if mode == "r"
-      $stdin.tty? ? read(options["stream_in"]) : stdio
+      $stdin.tty? ? read(options[:stream_in]) : stdio
     elsif mode == "w"
-      options["stream_out"] ? self.write(options["stream_out"], options["compress"]) : stdio
+      options[:stream_out] ? self.write(options[:stream_out], options[:compress]) : stdio
     else
       raise "Bad mode #{mode}"
     end
index 123b866f372f410d3d50131984a40a3d8ef16f52..fdab1ac4ebbddc839574c2562b6fc39ea8b049ae 100755 (executable)
@@ -44,13 +44,13 @@ class BiopiecesTest < Test::Unit::TestCase
 
   # >>>>>>>>>>>>>>>>>>>> Testing Options.new <<<<<<<<<<<<<<<<<<<<
 
-   test "Biopieces#parse with all cast keys don't raise" do
-     argv  = []
-     casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}]
-     assert_nothing_raised(CastError) { @bp.parse(argv, casts, SCRIPT_PATH) }
-   end
+  def test_Biopieces_parse_with_all_cast_keys_dont_raise
+    argv  = []
+    casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}]
+    assert_nothing_raised(CastError) { @bp.parse(argv, casts, SCRIPT_PATH) }
+  end
 
-  test "Biopieces#parse with illegal long cast values raises" do
+  def test_Biopieces_parse_with_illegal_long_cast_values_raises
     [nil, true, false, 1, 0, "a"].each do |long|
       argv  = []
       casts = [{:long=>long, :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}]
@@ -58,7 +58,7 @@ class BiopiecesTest < Test::Unit::TestCase
     end
   end
 
-  test "Biopieces#parse with legal long cast values don't raise" do
+  def test_Biopieces_parse_with_legal_long_cast_values_dont_raise
     ["foo", "!!", "0123"].each do |long|
       argv  = []
       casts = [{:long=>long, :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}]
@@ -66,7 +66,7 @@ class BiopiecesTest < Test::Unit::TestCase
     end
   end
 
-  test "Biopieces#parse with illegal short cast values raises" do
+  def test_Biopieces_parse_with_illegal_short_cast_values_raises
     [nil, true, false, "foo"].each do |short|
       argv  = []
       casts = [{:long=>"foo", :short=>short, :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}]
@@ -74,7 +74,7 @@ class BiopiecesTest < Test::Unit::TestCase
     end
   end
 
-  test "Biopieces#parse with legal short cast values don't raise" do
+  def test_Biopieces_parse_with_legal_short_cast_values_dont_raise
     ["!", "1", "a"].each do |short|
       argv  = []
       casts = [{:long=>"foo", :short=>short, :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}]
@@ -82,7 +82,7 @@ class BiopiecesTest < Test::Unit::TestCase
     end
   end
 
-  test "Biopieces#parse with illegal type cast values raises" do
+  def test_Biopieces_parse_with_illegal_type_cast_values_raises
     [nil, true, false, "foo", 12, 0].each do |type|
       argv  = []
       casts = [{:long=>"foo", :short=>"f", :type=>type, :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}]
@@ -90,7 +90,7 @@ class BiopiecesTest < Test::Unit::TestCase
     end
   end
 
-  test "Biopieces#parse with legal type cast values don't raise" do
+  def test_Biopieces_parse_with_legal_type_cast_values_dont_raise
     TYPES.each do |type|
       argv  = []
       casts = [{:long=>"foo", :short=>"f", :type=>type, :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}]
@@ -98,7 +98,7 @@ class BiopiecesTest < Test::Unit::TestCase
     end
   end
 
-  test "Biopieces#parse with illegal mandatory cast values raises" do
+  def test_Biopieces_parse_with_illegal_mandatory_cast_values_raises
     ["yes", 12, 0, nil].each do |mandatory|
       argv  = []
       casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>mandatory, :default=>nil, :allowed=>nil, :disallowed=>nil}]
@@ -106,7 +106,7 @@ class BiopiecesTest < Test::Unit::TestCase
     end
   end
 
-  test "Biopieces#parse with legal mandatory cast values don't raise" do
+  def test_Biopieces_parse_with_legal_mandatory_cast_values_dont_raise
     [true, false].each do |mandatory|
       argv  = [ "--foo", "1" ]
       casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>mandatory, :default=>nil, :allowed=>nil, :disallowed=>nil}]
@@ -114,7 +114,7 @@ class BiopiecesTest < Test::Unit::TestCase
     end
   end
 
-  test "Biopieces#parse with illegal default cast values raises" do
+  def test_Biopieces_parse_with_illegal_default_cast_values_raises
     [true, false, [], {}].each do |default|
       argv  = []
       casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>default, :allowed=>nil, :disallowed=>nil}]
@@ -122,7 +122,7 @@ class BiopiecesTest < Test::Unit::TestCase
     end
   end
 
-  test "Biopieces#parse with legal default cast values don't raise" do
+  def test_Biopieces_parse_with_legal_default_cast_values_dont_raise
     [nil, 0, 1, -1].each do |default|
       argv  = []
       casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>default, :allowed=>nil, :disallowed=>nil}]
@@ -130,7 +130,7 @@ class BiopiecesTest < Test::Unit::TestCase
     end
   end
 
-  test "Biopieces#parse with illegal allowed cast values raises" do
+  def test_Biopieces_parse_with_illegal_allowed_cast_values_raises
     [true, false, {}, [], 0, 0.1].each do |allowed|
       argv  = []
       casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>allowed, :disallowed=>nil}]
@@ -138,7 +138,7 @@ class BiopiecesTest < Test::Unit::TestCase
     end
   end
 
-  test "Biopieces#parse with legal allowed cast values don't raise" do
+  def test_Biopieces_parse_with_legal_allowed_cast_values_dont_raise
     ["foo,bar,0",nil].each do |allowed|
       argv  = []
       casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>allowed, :disallowed=>nil}]
@@ -146,7 +146,7 @@ class BiopiecesTest < Test::Unit::TestCase
     end
   end
 
-  test "Biopieces#parse with illegal disallowed cast values raises" do
+  def test_Biopieces_parse_with_illegal_disallowed_cast_values_raises
     [true, false, {}, [], 0, 0.1].each do |disallowed|
       argv  = []
       casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>disallowed}]
@@ -154,7 +154,7 @@ class BiopiecesTest < Test::Unit::TestCase
     end
   end
 
-  test "Biopieces#parse with legal disallowed cast values don't raise" do
+  def test_Biopieces_parse_with_legal_disallowed_cast_values_dont_raise
     ["foo,bar,0",nil].each do |disallowed|
       argv  = []
       casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>disallowed}]
@@ -162,7 +162,7 @@ class BiopiecesTest < Test::Unit::TestCase
     end
   end
 
-  test "Biopieces#parse with duplicate long cast values raises" do
+  def test_Biopieces_parse_with_duplicate_long_cast_values_raises
     argv  = []
     casts = []
     casts << {:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
@@ -170,7 +170,7 @@ class BiopiecesTest < Test::Unit::TestCase
     assert_raise(CastError) { @bp.parse(argv, casts, SCRIPT_PATH) }
   end
 
-  test "Biopieces#parse with duplicate short cast values raises" do
+  def test_Biopieces_parse_with_duplicate_short_cast_values_raises
     argv  = []
     casts = []
     casts << {:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
@@ -178,7 +178,7 @@ class BiopiecesTest < Test::Unit::TestCase
     assert_raise(CastError) { @bp.parse(argv, casts, SCRIPT_PATH) }
   end
 
-  test "Biopieces#parse without duplicate long and short cast values don't raise" do
+  def test_Biopieces_parse_without_duplicate_long_and_short_cast_values_dont_raise
     argv  = []
     casts = []
     casts << {:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
@@ -188,64 +188,64 @@ class BiopiecesTest < Test::Unit::TestCase
 
   # >>>>>>>>>>>>>>>>>>>> Testing Options.parse <<<<<<<<<<<<<<<<<<<<
 
-  test "Biopieces#parse with empty argv and missing wiki file raises" do
+  def test_Biopieces_parse_with_empty_argv_and_missing_wiki_file_raises
     argv  = []
     casts = []
-    assert_raise() { @bp.parse(argv,casts, "foo") }
+    assert_raise(RuntimeError) { @bp.parse(argv,casts, "foo") }
   end
 
-  test "Biopieces#parse with empty argv and existing wiki file don't raise" do
+  def test_Biopieces_parse_with_empty_argv_and_existing_wiki_file_dont_raise
     argv  = []
     casts = []
     assert_nothing_raised { @bp.parse(argv, casts, SCRIPT_PATH) }
   end
 
-   test "Biopieces#parse with --help in argv and existing wiki output long usage" do
-     argv = ["--help"]
-     assert_nothing_raised { @bp.parse(argv,[],SCRIPT_PATH) }
-   end
+  def test_Biopieces_parse_with_help_in_argv_and_existing_wiki_output_long_usage
+    argv = ["--help"]
+    assert_nothing_raised { @bp.parse(argv,[],SCRIPT_PATH) }
+  end
 
 #  # FIXME This one fails because any argument to a flag is ignored and the flag value is set to true. Should it raise?
-#  test "Options.parse with type cast flag with an argument raises" do
+#  test "Options.parse with type cast flag with an argument raises
 #    casts = [{:long=>"foo", :short=>"f", :type=>"flag", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}]
 #    opt_parser = Options.new(casts)
 #    assert_raise(ArgumentError) { opt_parser.parse(["--foo", "bar"],SCRIPT_PATH) }
 #   end
 
-  test "Biopieces#parse with --stream_in <arg> returns options['stream_in']=>[<arg>]" do
+  def test_Biopieces_parse_with_stream_in_argv_returns_correct_options
     argv = ["--stream_in", DUMMY_FILE]
     options = @bp.parse(argv,[],SCRIPT_PATH)
-    assert_equal([DUMMY_FILE], options["stream_in"])
+    assert_equal([DUMMY_FILE], options[:stream_in])
   end
 
-  test "Biopieces#parse with -I <arg> returns options['stream_in']=>[<arg>]" do
+  def test_Biopieces_parse_with_I_argv_returns_correct_options
     argv    = ["-I", DUMMY_FILE]
     casts   = []
     options = @bp.parse(argv, casts, SCRIPT_PATH)
-    assert_equal([DUMMY_FILE], options["stream_in"])
+    assert_equal([DUMMY_FILE], options[:stream_in])
   end
 
-  test "Biopieces#parse use cast default value if no argument given" do
+  def test_Biopieces_parse_use_cast_default_value_if_no_argument_given
     argv    = ["-I", DUMMY_FILE]
     casts   = [{:long=>"foo", :short=>"f", :type=>"string", :mandatory=>false, :default=>"bar", :allowed=>nil, :disallowed=>nil}]
     options = @bp.parse(argv, casts, SCRIPT_PATH)
-    assert_equal(options["foo"], "bar")
+    assert_equal(options[:foo], "bar")
   end
 
-  test "Biopieces#parse don't use default value if argument given" do
+  def test_Biopieces_parse_dont_use_default_value_if_argument_given
     argv    = ["--foo", "bleh", "-I", DUMMY_FILE]
     casts   = [{:long=>"foo", :short=>"f", :type=>"string", :mandatory=>false, :default=>"bar", :allowed=>nil, :disallowed=>nil}]
     options = @bp.parse(argv, casts, SCRIPT_PATH)
-    assert_equal(options["foo"], "bleh")
+    assert_equal(options[:foo], "bleh")
   end
 
-  test "Biopieces#parse with mandatory cast and no argument raises" do
+  def test_Biopieces_parse_with_mandatory_cast_and_no_argument_raises
     argv  = ["-I", DUMMY_FILE]
     casts = [{:long=>"foo", :short=>"f", :type=>"string", :mandatory=>true, :default=>nil, :allowed=>nil, :disallowed=>nil}]
     assert_raise(ArgumentError) { @bp.parse(argv,casts,SCRIPT_PATH) }
   end
 
-  test "Biopieces#parse with mandatory cast and argument don't raise" do
+  def test_Biopieces_parse_with_mandatory_cast_and_argument_dont_raise
     argv  = ["--foo", "bar", "-I", DUMMY_FILE]
     casts = [{:long=>"foo", :short=>"f", :type=>"string", :mandatory=>true, :default=>nil, :allowed=>nil, :disallowed=>nil}]
     assert_nothing_raised(ArgumentError) { @bp.parse(argv,casts,SCRIPT_PATH) }
@@ -261,7 +261,7 @@ class BiopiecesTest < Test::Unit::TestCase
 #    end
 #  end
 
-  test "Biopieces#parse with type cast int don't raise" do
+  def test_Biopieces_parse_with_type_cast_int_dont_raise
     [0,-1,1,327649123746293746374276347824].each do |val|
       argv  = ["--foo", "#{val}", "-I", DUMMY_FILE]
       casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}]
@@ -271,7 +271,7 @@ class BiopiecesTest < Test::Unit::TestCase
 
   # TODO similar test for uint as "test "Options.parse with type cast int and non-int value raises" do"
 
-  test "Biopieces#parse with type cast uint don't raise" do
+  def test_Biopieces_parse_with_type_cast_uint_dont_raise
     [0,1,327649123746293746374276347824].each do |val|
       argv  = ["--foo", "#{val}", "-I", DUMMY_FILE]
       casts = [{:long=>"foo", :short=>"f", :type=>"uint", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}]
@@ -279,51 +279,51 @@ class BiopiecesTest < Test::Unit::TestCase
     end
   end
 
-  test "Biopieces#parse with file! cast and file don't exists raises" do
+  def test_Biopieces_parse_with_file_cast_and_file_dont_exists_raises
     argv  = ["--foo", "bleh", "-I", DUMMY_FILE]
     casts = [{:long=>"foo", :short=>"f", :type=>"file!", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}]
     assert_raise(ArgumentError) { @bp.parse(argv, casts, SCRIPT_PATH) }
   end
 
-  test "Biopieces#parse with file! cast and existing file don't raise" do
+  def test_Biopieces_parse_with_file_cast_and_existing_file_dont_raise
     argv  = ["--foo", DUMMY_FILE, "-I", DUMMY_FILE]
     casts = [{:long=>"foo", :short=>"f", :type=>"file!", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}]
     assert_nothing_raised(ArgumentError) { @bp.parse(argv, casts, SCRIPT_PATH) }
   end
 
-  test "Biopieces#parse with files! cast and a file don't exists raises" do
+  def test_Biopieces_parse_with_files_cast_and_a_file_dont_exists_raises
     argv  = ["--foo", DUMMY_FILE + ",bleh", "-I", DUMMY_FILE]
     casts = [{:long=>"foo", :short=>"f", :type=>"files!", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}]
     assert_raise(ArgumentError) { @bp.parse(argv, casts, SCRIPT_PATH) }
   end
 
-  test "Biopieces#parse with files! cast and files exists don't raise" do
+  def test_Biopieces_parse_with_files_cast_and_files_exists_dont_raise
     argv  = ["--foo", DUMMY_FILE + "," + DUMMY_FILE, "-I", DUMMY_FILE]
     casts = [{:long=>"foo", :short=>"f", :type=>"files!", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}]
     assert_nothing_raised(ArgumentError) { @bp.parse(argv, casts, SCRIPT_PATH) }
   end
 
   # TODO replace the absolute part below the file location with File.dirname(__FILE__)
-  test "Biopieces#parse with glob argument expands correctly" do
+  def test_Biopieces_parse_with_glob_argument_expands_correctly
     argv    = ["--foo", "/Users/maasha/unit_test/foo*,/Users/maasha/unit_test/my_dir/*.fna", "-I", DUMMY_FILE]
     casts   = [{:long=>"foo", :short=>"f", :type=>"files!", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}]
     options = @bp.parse(argv, casts, SCRIPT_PATH)
-    assert_equal(options["foo"], ["/Users/maasha/unit_test/foo.fna", "/Users/maasha/unit_test/my_dir/bar.fna"])
+    assert_equal(options[:foo], ["/Users/maasha/unit_test/foo.fna", "/Users/maasha/unit_test/my_dir/bar.fna"])
   end
 
-  test "Biopieces#parse with dir! cast and dir don't exists raises" do
+  def test_Biopieces_parse_with_dir_cast_and_dir_dont_exists_raises
     argv  = ["--foo", "bleh", "-I", DUMMY_FILE]
     casts = [{:long=>"foo", :short=>"f", :type=>"dir!", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}]
     assert_raise(ArgumentError) { @bp.parse(argv, casts, SCRIPT_PATH) }
   end
 
-  test "Biopieces#parse with dir! cast and dir exists don't raise" do
+  def test_Biopieces_parse_with_dir_cast_and_dir_exists_dont_raise
     argv  = ["--foo", "/", "-I", DUMMY_FILE]
     casts = [{:long=>"foo", :short=>"f", :type=>"dir!", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}]
     assert_nothing_raised(ArgumentError) { @bp.parse(argv, casts, SCRIPT_PATH) }
   end
 
-  test "Biopieces#parse with allowed cast and not allowed value raises" do
+  def test_Biopieces_parse_with_allowed_cast_and_not_allowed_value_raises
     ["bleh", "2", "3.3"].each do |val|
       argv  = ["--foo", "#{val}", "-I", DUMMY_FILE]
       casts = [{:long=>"foo", :short=>"f", :type=>"string", :mandatory=>false, :default=>nil, :allowed=>"0,-1,0.0,1,bar", :disallowed=>nil}]
@@ -331,7 +331,7 @@ class BiopiecesTest < Test::Unit::TestCase
     end
   end
 
-  test "Biopieces#parse with allowed cast and allowed values don't raise" do
+  def test_Biopieces_parse_with_allowed_cast_and_allowed_values_dont_raise
     ["0", "-1", "0.0", "1", "bar"].each do |val|
       argv  = ["--foo", "#{val}", "-I", DUMMY_FILE]
       casts = [{:long=>"foo", :short=>"f", :type=>"string", :mandatory=>false, :default=>nil, :allowed=>"0,-1,0.0,1,bar", :disallowed=>nil}]
@@ -339,7 +339,7 @@ class BiopiecesTest < Test::Unit::TestCase
     end
   end
 
-  test "Biopieces#parse with disallowed cast and disallowed value raises" do
+  def test_Biopieces_parse_with_disallowed_cast_and_disallowed_value_raises
     ["0", "-1", "0.0", "1", "bar"].each do |val|
       argv  = ["--foo", "#{val}", "-I", DUMMY_FILE]
       casts = [{:long=>"foo", :short=>"f", :type=>"string", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>"0,-1,0.0,1,bar"}]
@@ -347,7 +347,7 @@ class BiopiecesTest < Test::Unit::TestCase
     end
   end
 
-  test "Biopieces#parse with disallowed cast and allowed values don't raise" do
+  def test_Biopieces_parse_with_disallowed_cast_and_allowed_values_dont_raise
     ["bleh", "2", "3.3"].each do |val|
       argv  = ["--foo", "#{val}", "-I", DUMMY_FILE]
       casts = [{:long=>"foo", :short=>"f", :type=>"string", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>"0,-1,0.0,1,bar"}]