Example #1
0
 def test_extract_data_dict(self):
     col = SheetColumn('bar')
     assert col.extract_data({
         'foo': 1,
         'bar': 'something',
         'baz': 'else'
     }) == 'something'
Example #2
0
 def test_extract_data_attr(self):
     col = SheetColumn('bar')
     assert col.extract_data(
         BlankObject(
             foo=1,
             bar='something',
             baz='else',
         )) == 'something'
Example #3
0
 def test_extract_data_attr(self):
     col = SheetColumn('bar')
     assert col.extract_data(
         BlankObject(
             foo=1,
             bar='something',
             baz='else',
         )
     ) == 'something'
Example #4
0
 def test_extract_data_string(self):
     col = SheetColumn('bar')
     assert col.extract_data({'foo': 1, 'baz': 'else'}) == 'bar'
Example #5
0
 def test_extract_data_dict(self):
     col = SheetColumn('bar')
     assert col.extract_data({'foo': 1, 'bar': 'something', 'baz': 'else'}) == 'something'
Example #6
0
 def test_extract_data_no_key(self):
     col = SheetColumn()
     assert col.extract_data({}) == ''
Example #7
0
 def test_extract_data_combined_float(self):
     col = SheetColumn((9.5, 8, operator.add))
     assert col.extract_data({}) == 17.5
Example #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
Example #9
0
 def test_extract_data_combined_string(self):
     col = SheetColumn(('foo', 'bar', operator.add))
     assert col.extract_data({'foo': 9, 'bar': 8}) == 17
Example #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
Example #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'
Example #12
0
 def test_extract_data_sacol(self):
     person = Person.testing_create()
     col = SheetColumn(Person.firstname)
     assert col.extract_data(person) == person.firstname
Example #13
0
 def test_extract_data_string(self):
     col = SheetColumn('bar')
     assert col.extract_data({'foo': 1, 'baz': 'else'}) == 'bar'
Example #14
0
 def test_extract_data_sacol(self):
     person = Person.testing_create()
     col = SheetColumn(Person.firstname)
     assert col.extract_data(person) == person.firstname
Example #15
0
 def test_extract_data_combined_float(self):
     col = SheetColumn((9.5, 8, operator.add))
     assert col.extract_data({}) == 17.5
Example #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'
Example #17
0
        class TestSheet(ReportSheet):
            def fetch_records(self):
                return []

            pre_data_rows = 3
            SheetColumn('key', header_2='foo', header_4='bar')
Example #18
0
 def test_extract_data_combined_string(self):
     col = SheetColumn(('foo', 'bar', operator.add))
     assert col.extract_data({'foo': 9, 'bar': 8}) == 17
Example #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
Example #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
Example #21
0
 def test_extract_data_no_key(self):
     col = SheetColumn()
     assert col.extract_data({}) == ''