コード例 #1
0
def test_companion_update_portrait_id():
    party = pytest.helpers.party_base(MAIN_CHAR_ID, COMP_UNIT_ID, COMPANION_ID)
    expected_id = next_id(party)
    character = CompanionInfo(party, COMPANION_KEY)
    character.update_portrait('blarg')
    assert companion(party)['UISettings']['m_CustomPortrait']['$id'] == str(
        expected_id)
    assert next_id(party) == expected_id + 1
コード例 #2
0
def test_next_id_with_none():
    highest = 5
    data = []
    for i in range(highest):
        data.append({'$id': str(i + 1)})
    data.append(None)
    assert next_id(data) == highest + 1
コード例 #3
0
 def update_portrait(self, new_portrait):
     portrait = self._character['UISettings']['m_CustomPortrait']
     try:
         portrait['m_CustomPortraitId'] = new_portrait
     except TypeError:
         self._character['UISettings']['m_CustomPortrait'] = {
             '$id': str(next_id(self._party_data)),
             'm_CustomPortraitId': new_portrait
         }
コード例 #4
0
def test_next_id_multiple_one_level():
    highest = 5
    data = []
    for i in range(highest):
        data.append({'$id': str(i + 1)})
    assert next_id(data) == highest + 1
コード例 #5
0
def test_next_id_one_value_one_level_larger():
    highest = 2
    data = {'$id': str(highest)}
    assert next_id(data) == highest + 1
コード例 #6
0
def test_with_full_party_data():
    party = pytest.helpers.party_base(1, 2, 3)
    assert next_id(party) == 6600
コード例 #7
0
def test_next_with_multiple_levels():
    count = 5
    data = []
    for i in range(count):
        data.append({'$id': str(i + 1), 'child': {'$id': str(i + count + 1)}})
    assert next_id(data) == (2 * count) + 1