datapipeline 3.0.0: transform, Parallelmodus, chained und String-Bedingungen entfernt
This commit is contained in:
+1
-30
@@ -1,6 +1,6 @@
|
||||
require_relative '../test_helper'
|
||||
|
||||
# rename, select, cast, default and the deprecation warnings
|
||||
# rename, select, cast, default
|
||||
class StepsTest < PipelineTest
|
||||
ROWS = [{ 'kunnr' => '1', 'betrag' => '12.50', 'datum' => '2026-10-09', 'land' => nil },
|
||||
{ 'kunnr' => '2', 'betrag' => '', 'datum' => ' ', 'land' => 'DE' }].freeze
|
||||
@@ -44,33 +44,4 @@ class StepsTest < PipelineTest
|
||||
end
|
||||
assert_equal [{ 'id' => '1', 'betrag' => 12.5 }, { 'id' => '2', 'betrag' => 0.0 }], rows
|
||||
end
|
||||
|
||||
def deprecation_log(&block)
|
||||
log = StringIO.new
|
||||
DataPipeline.new do
|
||||
logger Logger.new(log)
|
||||
read MemoryStorage.new(rows: [{ 'a' => 1 }])
|
||||
write MemoryStorage.new
|
||||
instance_eval(&block)
|
||||
end.run
|
||||
log.string.lines.grep(/deprecated/)
|
||||
end
|
||||
|
||||
def test_deprecations_once_per_process
|
||||
lines = deprecation_log do
|
||||
transform(condition: 'true') { |r| r }
|
||||
transform { |r| r }
|
||||
end
|
||||
assert_equal 3, lines.size
|
||||
assert lines.any? { |l| l.include?('transform is deprecated') }
|
||||
assert lines.any? { |l| l.include?('parallel mode') }
|
||||
assert lines.any? { |l| l.include?('condition: as string') }
|
||||
assert_empty deprecation_log { transform { |r| r } }
|
||||
end
|
||||
|
||||
def test_no_deprecation_for_map_filter_and_single_transform_in_chained_mode
|
||||
assert_empty deprecation_log { map { |r| r }; filter(condition: ->(_r) { true }) { true } }
|
||||
lines = deprecation_log { chained; transform { |r| r }; transform { |r| r } }
|
||||
assert_equal 1, lines.size # only transform, no parallel mode
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user