Sha256: 56f2f2ce8c4eeb899e138fdc49ce8917c396edbdf8ff25ac4faa968ec7e4d667
Contents?: true
Size: 819 Bytes
Versions: 105
Compression:
Stored size: 819 Bytes
Contents
require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'test_helper.rb') require 'rbbt/tsv' require 'rbbt/tsv/change_id' class TestTSVChangeID < Test::Unit::TestCase FILE1=<<-EOF #: :sep=' ' #A B C a b c aa bb cc EOF FILE2=<<-EOF #: :sep=' ' #X Y Z x y z xx yy zz EOF IDENTIFIERS=<<-EOF #: :sep=' ' #A X a x aa xx EOF def tsv(text, options = {}) options = Misc.add_defaults options, :type => :list TSV.open StringIO.new(text), options end def setup @f1 = tsv(FILE1) @f2 = tsv(FILE2) @f3 = tsv(FILE2, :key_field => "Y") @id = tsv(IDENTIFIERS) end def test_swap_id @f3.identifiers = @id assert_equal "a", @f3.swap_id("X","A")["y"]["A"] end def test_change_key @f1.identifiers = @id assert @f1.change_key("X").include? "x" end end
Version data entries
105 entries across 105 versions & 1 rubygems