def setUp(self): self.rows = ((1, 4, 'a'), (2, 3, 'b'), (None, 2, 'c')) self.column_names = ('one', 'two', 'three') self.number_type = NumberType() self.text_type = TextType() self.column_types = (self.number_type, self.number_type, self.text_type)
def setUp(self): self.rows = (('a', 2, 3, 4), (None, 3, 5, None), ('a', 2, 4, None), ('b', 3, 4, None)) self.number_type = NumberType() self.text_type = TextType() self.column_types = (self.text_type, self.number_type, self.number_type, self.number_type) self.column_names = ('one', 'two', 'three', 'four')
def setUp(self): self.rows = ((Decimal('1.1'), Decimal('2.19'), 'a'), (Decimal('2.7'), Decimal('3.42'), 'b'), (None, Decimal('4.1'), 'c'), (Decimal('2.7'), Decimal('3.42'), 'c')) self.column_names = ('one', 'two', 'three') self.number_type = NumberType() self.text_type = TextType() self.column_types = (self.number_type, self.number_type, self.text_type) self.table = Table(self.rows, self.column_types, self.column_names)
def setUp(self): self.left_rows = ((1, 4, 'a'), (2, 3, 'b'), (None, 2, 'c')) self.right_rows = ((1, 4, 'a'), (2, 3, 'b'), (None, 2, 'c')) self.number_type = NumberType() self.text_type = TextType() self.column_types = (self.number_type, self.number_type, self.text_type) self.left = Table(self.left_rows, self.column_types, ('one', 'two', 'three')) self.right = Table(self.right_rows, self.column_types, ('four', 'five', 'six'))
def test_text_cast(self): values = ('a', 1, None, Decimal('2.7'), 'n/a') casted = tuple(TextType().cast(v) for v in values) self.assertSequenceEqual(casted, ('a', '1', None, '2.7', None))
def test_text(self): self.assertIsInstance(TextType()._create_column(None, 1), TextColumn)