def test_suds_to_row_no_compensation():
    suds_obj = make_suds('A Duns', 'Par Duns', 'Par Name')
    suds_obj.coreData.listOfExecutiveCompensationInformation = ''
    row = fileE.suds_to_row(suds_obj)
    assert row == fileE.Row('A Duns', 'Par Duns', 'Par Name', '', '', '', '', '', '', '', '', '', '')

    del suds_obj.coreData.listOfExecutiveCompensationInformation
    row = fileE.suds_to_row(suds_obj)
    assert row == fileE.Row('A Duns', 'Par Duns', 'Par Name', '', '', '', '', '', '', '', '', '', '')
def test_suds_to_row_too_many_compensation():
    suds_obj = make_suds('B Duns', 'Par DunsB', 'Par NameB')
    info = suds_obj.coreData.listOfExecutiveCompensationInformation
    info.executiveCompensationDetail = [Mock(compensation=i * 11.11) for i in range(1, 10)]
    for idx, person in enumerate(info.executiveCompensationDetail):
        # Can't do this in the constructor as "name" is a reserved word
        person.name = "Person {}".format(idx + 1)

    row = fileE.suds_to_row(suds_obj)
    assert row == fileE.Row(
        'B Duns', 'Par DunsB', 'Par NameB',
        'Person 9', 99.99, 'Person 8', 88.88, 'Person 7', 77.77,
        'Person 6', 66.66, 'Person 5', 55.55)
def test_suds_to_row_too_few_compensation():
    suds_obj = make_suds('B Duns', 'Legal Business Name', 'Par DunsB',
                         'Par NameB')
    info = suds_obj.coreData.listOfExecutiveCompensationInformation

    middle = Mock(compensation=111.11)
    middle.name = 'Middle Person'  # "name" is a reserved word
    top = Mock(compensation=222.22)
    top.name = 'Top Person'
    bottom = Mock(compensation=0.0)
    bottom.name = 'Bottom Person'

    info.executiveCompensationDetail = [middle, top, bottom]
    row = fileE.suds_to_row(suds_obj)
    assert row == fileE.Row('B Duns', 'Legal Business Name', 'Par DunsB',
                            'Par NameB', 'Top Person', 222.22, 'Middle Person',
                            111.11, 'Bottom Person', 0.0, '', '', '',
                            '')  # fills out to 5 pairs
def test_suds_to_row_too_few_compensation():
    suds_obj = make_suds('B Duns', 'Par DunsB', 'Par NameB')
    info = suds_obj.coreData.listOfExecutiveCompensationInformation

    middle = Mock(compensation=111.11)
    middle.name = 'Middle Person'   # "name" is a reserved word
    top = Mock(compensation=222.22)
    top.name = 'Top Person'
    bottom = Mock(compensation=0.0)
    bottom.name = 'Bottom Person'

    info.executiveCompensationDetail = [middle, top, bottom]
    row = fileE.suds_to_row(suds_obj)
    assert row == fileE.Row(
        'B Duns', 'Par DunsB', 'Par NameB',
        'Top Person', 222.22,
        'Middle Person', 111.11,
        'Bottom Person', 0.0,
        '', '', '', '')     # fills out to 5 pairs