示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 def testFalseWhenEmpty(self):
     """ResultRow is boolean False when empty."""
     row = sqlresult.ResultRow([], [])
     self.assertFalse(row)
示例#4
0
 def setUp(self):
     """Set up a persistent test environment."""
     names = ['name', 'nationality', 'age']
     values = ('Elmer', 'Dutch', 24)
     self.row = sqlresult.ResultRow(names, values)
示例#5
0
 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)
示例#6
0
 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)
示例#7
0
 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)