Permalink
Browse files

With minor change, needs_clarity test for ccoholic now passes.

  • Loading branch information...
1 parent 838dda0 commit 25cf750daaed7b2da7c1021fd2949ca444a0eb22 @zerebubuth committed Apr 25, 2012
Showing with 42 additions and 41 deletions.
  1. +1 −1 geom.rb
  2. +0 −40 test_needs_clarity.rb
  3. +41 −0 test_node.rb
View
@@ -39,7 +39,7 @@ def apply!(obj, options = {})
end
def to_s
- "NodeDiff[#{@null_move},#{@position}]"
+ @null_move ? "NodeDiff[]" : "NodeDiff#{@position.inspect}"
end
private
View
@@ -26,46 +26,6 @@ def setup
3 => Changeset[User[false]]
})
end
-
- # this is a node with some early bad content all of which has been eradicated many versions ago
- # It also has an old tag mapped by a problem mapper reintroduced later by an agreeing mapper.
- # LWG has clarified that such reintroductions are clean _if_ they happen in a separate changeset
- # to the removal of the tag. (that is, tax is put back in a separate context, we apply good faith in the agreeing mapper)
- #
- # NOTE: this needs some thought.
- # the issue is that the "foo=bar" tag re-added in v9 is the same as a tag added by
- # a decliner in v1. on the basis of identity it might be hard to tell whether this
- # is newly-surveyed data, or added by looking at the object's history.
- #
- # so the question is: can a tag added by an agreer in a later version of an element,
- # even though it may be similar to a previously-removed tag added by a decliner, be
- # considered clean?
- #
- def test_node_reformed_ccoholic
- history = [OSM::Node[[0,0], :id => 1, :changeset => 3, :version => 1, "foo" => "bar"], # created by decliner
- OSM::Node[[0,0], :id => 1, :changeset => 3, :version => 2 ], # tag removed by decliner
- OSM::Node[[0,0], :id => 1, :changeset => 3, :version => 3, "sugar" => "sweet" ], # tag added by decliner
- OSM::Node[[1,1], :id => 1, :changeset => 2, :version => 4, "sugar" => "sweet", "bar" => "baz"], # other tag added, node moved by agreer
- OSM::Node[[1,1], :id => 1, :changeset => 3, :version => 5, "sugar" => "sweet", "rose" => "red", "bar" => "baz" ], # tag added by decliner
- OSM::Node[[1,1], :id => 1, :changeset => 2, :version => 6, "sugar" => "sweet", "bar" => "baz", "dapper" => "mapper" ], # tag added by agreer, dirty tag removed
- OSM::Node[[2,2], :id => 1, :changeset => 1, :version => 7, "bar" => "baz", "dapper" => "mapper" ], # moved by agreer
- OSM::Node[[2,2], :id => 1, :changeset => 2, :version => 8, "bar" => "baz", "dapper" => "mapper", "e" => "mc**2" ], # tag added by agreer
- OSM::Node[[2,2], :id => 1, :changeset => 2, :version => 9, "bar" => "baz", "dapper" => "mapper", "e" => "mc**2", "foo" => "bar" ]] # tag re-added by agreer
- bot = ChangeBot.new(@db)
- actions = bot.action_for(history)
- # this is effectively a revert back to version 8 (because v9 re-adds the tainted "foo=bar" tag)
- # ^^^^^^^^^^^^^^^^^^^^^^ -- this needs more thought
- # and then hides version 6 and before because v6-v3 have the "sugar=sweet" tag which was added
- # by a decliner and is therefore tainted, and v1 & v2 are decliner edits.
- assert_equal([Redact[OSM::Node, 1, 1, :hidden],
- Redact[OSM::Node, 1, 2, :hidden],
- Redact[OSM::Node, 1, 3, :hidden],
- Redact[OSM::Node, 1, 4, :visible],
- Redact[OSM::Node, 1, 5, :hidden],
- Redact[OSM::Node, 1, 6, :visible],
- ], actions)
- end
-
end
if __FILE__ == $0
View
@@ -283,6 +283,47 @@ def test_node_reformed_ccoholic_simple
], actions)
end
+
+ # this is a node with some early bad content all of which has been eradicated many versions ago
+ # It also has an old tag mapped by a problem mapper reintroduced later by an agreeing mapper.
+ # LWG has clarified that such reintroductions are clean _if_ they happen in a separate changeset
+ # to the removal of the tag. (that is, tax is put back in a separate context, we apply good faith in the agreeing mapper)
+ #
+ # NOTE: this needs some thought.
+ # the issue is that the "foo=bar" tag re-added in v9 is the same as a tag added by
+ # a decliner in v1. on the basis of identity it might be hard to tell whether this
+ # is newly-surveyed data, or added by looking at the object's history.
+ #
+ # so the question is: can a tag added by an agreer in a later version of an element,
+ # even though it may be similar to a previously-removed tag added by a decliner, be
+ # considered clean?
+ #
+ def test_node_reformed_ccoholic
+ history = [OSM::Node[[0,0], :id => 1, :changeset => 3, :version => 1, "foo" => "bar"], # created by decliner
+ OSM::Node[[0,0], :id => 1, :changeset => 3, :version => 2 ], # tag removed by decliner
+ OSM::Node[[0,0], :id => 1, :changeset => 3, :version => 3, "sugar" => "sweet" ], # tag added by decliner
+ OSM::Node[[1,1], :id => 1, :changeset => 2, :version => 4, "sugar" => "sweet", "bar" => "baz"], # other tag added, node moved by agreer
+ OSM::Node[[1,1], :id => 1, :changeset => 3, :version => 5, "sugar" => "sweet", "rose" => "red", "bar" => "baz" ], # tag added by decliner
+ OSM::Node[[1,1], :id => 1, :changeset => 2, :version => 6, "sugar" => "sweet", "bar" => "baz", "dapper" => "mapper" ], # tag added by agreer, dirty tag removed
+ OSM::Node[[2,2], :id => 1, :changeset => 1, :version => 7, "bar" => "baz", "dapper" => "mapper" ], # moved by agreer
+ OSM::Node[[2,2], :id => 1, :changeset => 2, :version => 8, "bar" => "baz", "dapper" => "mapper", "e" => "mc**2" ], # tag added by agreer
+ OSM::Node[[2,2], :id => 1, :changeset => 2, :version => 9, "bar" => "baz", "dapper" => "mapper", "e" => "mc**2", "foo" => "bar" ]] # tag re-added by agreer
+ bot = ChangeBot.new(@db)
+ actions = bot.action_for(history)
+ # this is effectively a revert back to version 8 (because v9 re-adds the tainted "foo=bar" tag)
+ # and then hides version 6 and before because v6-v3 have the "sugar=sweet" tag which was added
+ # by a decliner and is therefore tainted, and v1 & v2 are decliner edits.
+ assert_equal([Edit[OSM::Node[[2,2], :id => 1, :changeset => -1, :version => 9, "bar" => "baz", "dapper" => "mapper", "e" => "mc**2" ]],
+ Redact[OSM::Node, 1, 1, :hidden],
+ Redact[OSM::Node, 1, 2, :visible],
+ Redact[OSM::Node, 1, 3, :hidden],
+ Redact[OSM::Node, 1, 4, :visible],
+ Redact[OSM::Node, 1, 5, :hidden],
+ Redact[OSM::Node, 1, 6, :visible],
+ Redact[OSM::Node, 1, 9, :visible],
+ ], actions)
+ end
+
# Identical to test_node_reformed_ccoholic but the tag is reintroduced in the same change set as it is deleted
# LWG has concluded that this may be risky and would prefer to see odbl=clean used in such cases with no tag deletion and replacement

0 comments on commit 25cf750

Please sign in to comment.