1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 06:37:17 +00:00

Make non-numeric delta comparison case insensitive

Fixes #239.
This commit is contained in:
Virgil Dupras
2013-11-23 15:31:20 -05:00
parent 0e542577b0
commit c34c9562d3
4 changed files with 32 additions and 11 deletions

View File

@@ -44,3 +44,13 @@ def test_delta_flags_delta_mode_on_non_delta_columns():
assert not app.rtable[3].is_cell_delta('name')
# "ibabtu" == "ibabtu", flag off
assert not app.rtable[4].is_cell_delta('name')
def test_delta_flags_delta_mode_on_non_delta_columns_case_insensitive():
# Comparison that occurs for non-numeric columns to check whether they're delta is case
# insensitive
app = app_with_results()
app.app.results.groups[1].ref.name = "ibAbtu"
app.app.results.groups[1].dupes[0].name = "IBaBTU"
app.rtable.delta_values = True
# "ibAbtu" == "IBaBTU", flag off
assert not app.rtable[4].is_cell_delta('name')

View File

@@ -230,6 +230,23 @@ class TestCaseResultsWithSomeGroups:
# also remove group ref
assert self.results.get_group_of_duplicate(ref) is None
def test_dupe_list_sort_delta_values_nonnumeric(self):
# When sorting dupes in delta mode on a non-numeric column, our first sort criteria is if
# the string is the same as its ref.
g1r, g1d1, g1d2, g2r, g2d1 = self.objects
# "aaa" makes our dupe go first in alphabetical order, but since we have the same value as
# ref, we're going last.
g2r.name = g2d1.name = "aaa"
self.results.sort_dupes('name', delta=True)
eq_("aaa", self.results.dupes[2].name)
def test_dupe_list_sort_delta_values_nonnumeric_case_insensitive(self):
# Non-numeric delta sorting comparison is case insensitive
g1r, g1d1, g1d2, g2r, g2d1 = self.objects
g2r.name = "AaA"
g2d1.name = "aAa"
self.results.sort_dupes('name', delta=True)
eq_("aAa", self.results.dupes[2].name)
class TestCaseResultsWithSavedResults:
def setup_method(self, method):