示例#1
0
 def test_extract_data_dict(self):
     col = SheetColumn('bar')
     assert col.extract_data({
         'foo': 1,
         'bar': 'something',
         'baz': 'else'
     }) == 'something'
示例#2
0
 def test_extract_data_attr(self):
     col = SheetColumn('bar')
     assert col.extract_data(
         BlankObject(
             foo=1,
             bar='something',
             baz='else',
         )) == 'something'
示例#3
0
 def test_extract_data_attr(self):
     col = SheetColumn('bar')
     assert col.extract_data(
         BlankObject(
             foo=1,
             bar='something',
             baz='else',
         )
     ) == 'something'
示例#4
0
 def test_extract_data_string(self):
     col = SheetColumn('bar')
     assert col.extract_data({'foo': 1, 'baz': 'else'}) == 'bar'
示例#5
0
 def test_extract_data_dict(self):
     col = SheetColumn('bar')
     assert col.extract_data({'foo': 1, 'bar': 'something', 'baz': 'else'}) == 'something'
示例#6
0
 def test_extract_data_no_key(self):
     col = SheetColumn()
     assert col.extract_data({}) == ''
示例#7
0
 def test_extract_data_combined_float(self):
     col = SheetColumn((9.5, 8, operator.add))
     assert col.extract_data({}) == 17.5
示例#8
0
 def test_extract_data_combined_sacol(self):
     person = Person.testing_create(intcol=8, floatcol=9)
     col = SheetColumn((Person.intcol, Person.floatcol, operator.add))
     assert col.extract_data(person) == 17
示例#9
0
 def test_extract_data_combined_string(self):
     col = SheetColumn(('foo', 'bar', operator.add))
     assert col.extract_data({'foo': 9, 'bar': 8}) == 17
示例#10
0
 def test_extract_data_combined_sacol(self):
     person = Person.testing_create(intcol=8, floatcol=9)
     col = SheetColumn((Person.intcol, Person.floatcol, operator.add))
     assert col.extract_data(person) == 17
示例#11
0
 def test_extract_data_sacol_altcolname(self):
     person = Person.testing_create(lastname=u'foo')
     col = SheetColumn(Person.lastname)
     assert col.extract_data(person) == 'foo'
示例#12
0
 def test_extract_data_sacol(self):
     person = Person.testing_create()
     col = SheetColumn(Person.firstname)
     assert col.extract_data(person) == person.firstname
示例#13
0
 def test_extract_data_string(self):
     col = SheetColumn('bar')
     assert col.extract_data({'foo': 1, 'baz': 'else'}) == 'bar'
示例#14
0
 def test_extract_data_sacol(self):
     person = Person.testing_create()
     col = SheetColumn(Person.firstname)
     assert col.extract_data(person) == person.firstname
示例#15
0
 def test_extract_data_combined_float(self):
     col = SheetColumn((9.5, 8, operator.add))
     assert col.extract_data({}) == 17.5
示例#16
0
 def test_extract_data_sacol_altcolname(self):
     person = Person.testing_create(lastname=u'foo')
     col = SheetColumn(Person.lastname)
     assert col.extract_data(person) == 'foo'
示例#17
0
        class TestSheet(ReportSheet):
            def fetch_records(self):
                return []

            pre_data_rows = 3
            SheetColumn('key', header_2='foo', header_4='bar')
示例#18
0
 def test_extract_data_combined_string(self):
     col = SheetColumn(('foo', 'bar', operator.add))
     assert col.extract_data({'foo': 9, 'bar': 8}) == 17
示例#19
0
 def test_width(self):
     col = SheetColumn('key')
     col.register_col_width('something')
     col.register_col_width('something else')
     assert col.xls_computed_width == 14
示例#20
0
 def test_width(self):
     col = SheetColumn('key')
     col.register_col_width('something')
     col.register_col_width('something else')
     assert col.xls_computed_width == 14
示例#21
0
 def test_extract_data_no_key(self):
     col = SheetColumn()
     assert col.extract_data({}) == ''