def test_sort_int(self): row1 = self.FakeRow({'name': 1}) row2 = self.FakeRow({'name': 2}) model = self.FakeModel([row1, row2]) assert sort_func(model, 0, 1, 'name') == -1
def test_one_none(self): row1 = self.FakeRow({}) row2 = self.FakeRow({'name': 'abc'}) model = self.FakeModel([row1, row2]) assert sort_func(model, 0, 1, 'name') == -1
def test_sort_strings_with_no_caps(self): row1 = self.FakeRow({'name': 'abc'}) row2 = self.FakeRow({'name': 'def'}) model = self.FakeModel([row1, row2]) assert sort_func(model, 0, 1, 'name') == -1
def test_sort_mismatched_types(self): row1 = self.FakeRow({'name': 'abc'}) row2 = self.FakeRow({'name': 1}) model = self.FakeModel([row1, row2]) with self.assertRaises(TypeError): assert sort_func(model, 0, 1, 'name') == -1
def test_both_none(self): row1 = self.FakeRow({}) row2 = self.FakeRow({}) model = self.FakeModel([row1, row2]) assert sort_func(model, 0, 1, 'name') == 0
def test_one_none(self): row1 = self.FakeRow({}) row2 = self.FakeRow({'name': 'abc'}) model = self.FakeModel([row1, row2]) assert sort_func(model, 0, 1, 'name') == -1
def test_both_none(self): row1 = self.FakeRow({}) row2 = self.FakeRow({}) model = self.FakeModel([row1, row2]) assert sort_func(model, 0, 1, 'name') == 0
def test_sort_mismatched_types(self): row1 = self.FakeRow({'name': 'abc'}) row2 = self.FakeRow({'name': 1}) model = self.FakeModel([row1, row2]) with self.assertRaises(TypeError): assert sort_func(model, 0, 1, 'name') == -1
def test_sort_int(self): row1 = self.FakeRow({'name': 1}) row2 = self.FakeRow({'name': 2}) model = self.FakeModel([row1, row2]) assert sort_func(model, 0, 1, 'name') == -1
def test_sort_strings_with_no_caps(self): row1 = self.FakeRow({'name': 'abc'}) row2 = self.FakeRow({'name': 'def'}) model = self.FakeModel([row1, row2]) assert sort_func(model, 0, 1, 'name') == -1