def testNonEqualityWithDifferentSize(self): """ResultRow is not equal to a ResultSet with a different length.""" self.names.append('animal') values_copy = list(self.values) values_copy.append('pink ponies') bigger = sqlresult.ResultRow(self.names, values_copy) self.assertNotEqual(self.row, bigger) self.assertNotEqual(bigger, self.row)
def setUp(self): """Set up a persistent test environment.""" self.names = [ 'name', 'project', 'age', 'language', 'character', 'distro-of-choice' ] self.values = ('Elmer', 'Underdark', 24, 'python', 'geek', u'Ubuntu') self.row = sqlresult.ResultRow(self.names, self.values)
def testFalseWhenEmpty(self): """ResultRow is boolean False when empty.""" row = sqlresult.ResultRow([], []) self.assertFalse(row)
def setUp(self): """Set up a persistent test environment.""" names = ['name', 'nationality', 'age'] values = ('Elmer', 'Dutch', 24) self.row = sqlresult.ResultRow(names, values)
def testNonEqualityWithDifferentValues(self): """ResultRow is not equal to a ResultRow with different values.""" values_copy = list(self.values) values_copy[1] = 'Bob' other_values = sqlresult.ResultRow(self.names, values_copy) self.assertNotEqual(self.row, other_values)
def testNonEqualityWithDifferentNames(self): """ResultRow is not equal to a ResultRow with different fieldnames.""" names_copy = self.names[:] names_copy[1] = 'not the same' other_names = sqlresult.ResultRow(names_copy, self.values) self.assertNotEqual(self.row, other_names)
def testEqualityWithResultRow(self): """ResultRow is equal to another ResultRow with the same contents.""" other = sqlresult.ResultRow(self.names, self.values) self.assertNotEqual(id(self.row), id(other)) self.assertEquals(self.row, other)