예제 #1
0
class ExcelExportTests(TestCase):
    def setUp(self):
        self.data = MultiValueDict([
            (CODE, ['val']),
            (MULTI_CODE, ['val1', 'val2']),
        ])
        self.export = ExcelExport({})

    def test_make_cell_non_present_allow_blank_implicit(self):
        self.assertEquals('', self.export.make_cell(self.data, 'not_present'))

    def test_make_cell_non_present_allow_blank_explicit(self):
        self.export.allow_blank = {'not_present'}
        self.assertEquals('', self.export.make_cell(self.data, 'not_present'))

    def test_make_cell_non_present_not_allow_blank(self):
        self.export.allow_blank = {CODE}
        self.assertEquals('0', self.export.make_cell(self.data, 'not_present'))

    def test_make_cell_present_single_value(self):
        self.assertEquals('val', self.export.make_cell(self.data, CODE))

    def test_make_cell_present_multi_value(self):
        self.assertEquals('val1, val2',
                          self.export.make_cell(self.data, MULTI_CODE))
예제 #2
0
class ExcelExportTests(TestCase):
    def setUp(self):
        self.data = MultiValueDict(
            [
                (CODE, ['val']),
                (MULTI_CODE, ['val1', 'val2']),
            ]
        )
        self.export = ExcelExport({})

    def test_make_cell_non_present_allow_blank_implicit(self):
        self.assertEquals('', self.export.make_cell(self.data, 'not_present'))

    def test_make_cell_non_present_allow_blank_explicit(self):
        self.export.allow_blank = {'not_present'}
        self.assertEquals('', self.export.make_cell(self.data, 'not_present'))

    def test_make_cell_non_present_not_allow_blank(self):
        self.export.allow_blank = {CODE}
        self.assertEquals('0', self.export.make_cell(self.data, 'not_present'))

    def test_make_cell_present_single_value(self):
        self.assertEquals('val', self.export.make_cell(self.data, CODE))

    def test_make_cell_present_multi_value(self):
        self.assertEquals('val1, val2', self.export.make_cell(self.data, MULTI_CODE))
예제 #3
0
 def setUp(self):
     self.data = MultiValueDict(
         [
             (CODE, ['val']),
             (MULTI_CODE, ['val1', 'val2']),
         ]
     )
     self.export = ExcelExport({})
예제 #4
0
 def setUp(self):
     self.data = MultiValueDict([
         (CODE, ['val']),
         (MULTI_CODE, ['val1', 'val2']),
     ])
     self.export = ExcelExport({})