def test_empty_table():
    empty = Table(
        [Text('name', description='Name for first column'), Float('value', description='VValue'),
         Sequence('zzz'), Sequence('zzzzzzzzzzzzzzzzzz')],
        table_name='Wooho'
    )
    assert empty.get_table() == EXPECTED_EMPTY_TABLE
예제 #2
0
def log_planets():
    universe = fo.get_universe()

    planets_table = Table([
        Text('id'),
        Text('name'),
        Text('system'),
        Text('type'),
        Sequence('specials'),
        Text('species'),
        Sequence('buildings')
    ],
                          table_name='Planets summary')
    # group planets by system
    for sid in fo.get_systems():
        for pid in fo.sys_get_planets(sid):
            planet = universe.getPlanet(pid)

            planet_type = fo.planet_get_type(pid).name
            planet_size = fo.planet_get_size(pid).name
            if planet_type != planet_size:
                planet_type = '%s %s' % (planet_type, planet_size)

            buildings = [
                universe.getBuilding(x).name for x in planet.buildingIDs
            ]
            planets_table.add_row([
                pid, planet.name, planet.systemID, planet_type,
                list(planet.specials), planet.speciesName, buildings
            ])

    # Printing too much info at once will lead to truncation of text
    for line in planets_table.get_table().split('\n'):
        print line
예제 #3
0
def log_planets():
    universe = fo.get_universe()

    planets_table = Table(
        [Text('id'), Text('name'), Text('system'), Text('type'),
         Sequence('specials'), Text('species'), Sequence('buildings')],
        table_name='Planets summary')
    # group planets by system
    for sid in fo.get_systems():
        for pid in fo.sys_get_planets(sid):
            planet = universe.getPlanet(pid)

            planet_type = fo.planet_get_type(pid).name
            planet_size = fo.planet_get_size(pid).name
            if planet_type != planet_size:
                planet_type = '%s %s' % (planet_type, planet_size)

            buildings = [universe.getBuilding(x).name for x in planet.buildingIDs]
            planets_table.add_row([
                pid, planet.name, planet.systemID, planet_type, list(planet.specials), planet.speciesName, buildings
            ])

    # Printing too much info at once will lead to truncation of text
    for line in planets_table.get_table().split('\n'):
        print line
예제 #4
0
def _report_classes_without_instances(classes_map, instance_names,
                                      classes_to_ignore: set):
    missed_instances = instance_names.symmetric_difference(
        classes_map).difference(classes_to_ignore)

    if not missed_instances:
        return

    warning("")
    warning(
        "In order to get more information about the classes in API we need to process an instances of thea classes."
    )
    warning(
        "Classes mentioned bellow does not have instances so their specs are not full."
    )
    warning("Please provide instances or add them to ignored,")
    warning(
        "check generate_stub usage in the freeorion/default/python/handlers folder."
    )
    warning("")

    table = Table([Text("classes")], )

    for inst in sorted(missed_instances, key=str.lower):
        table.add_row((str(inst), ))
    warning(table.get_table())
예제 #5
0
def test_empty_table():
    empty = Table(
        [
            Text("name", description="Name for first column"),
            Float("value", description="VValue"),
            Sequence("zzz"),
            Sequence("zzzzzzzzzzzzzzzzzz"),
        ],
        table_name="Wooho",
    )
    assert empty.get_table() == EXPECTED_EMPTY_TABLE
def test_simple_table():
    t = Table(
        [Text('name', description='Name for first column'), Float('value', description='VValue'),
         Sequence('zzz'), Sequence('zzzzzzzzzzzzzzzzzz')],
        table_name='Wooho')
    t.add_row(['hello', 144444, 'abcffff', 'a'])
    t.add_row([u'Plato aa\u03b2 III', 21, 'de', 'a'])
    t.add_row([u'Plato \u03b2 III', 21, 'de', 'a'])
    t.add_row(['Plato B III', 21, 'd', 'a'])
    t.add_row(['Plato Bddddd III', 21, 'd', 'a'])
    t.add_row(['Plato III', 21, 'd', 'a'])
    assert t.get_table() == EXPECTED_SIMPLE_TABLE
예제 #7
0
def log_systems():
    universe = fo.get_universe()

    systems_table = Table(
        [Text('id'), Text('name'), Sequence('planets'), Sequence('connections'), Text('star')],
        table_name='System summary')
    for sid in fo.get_systems():
        system = universe.getSystem(sid)
        systems_table.add_row([
            sid, system.name, fo.sys_get_planets(sid), fo.sys_get_starlanes(sid), system.starType.name
        ])

    # Printing too much info at once will lead to truncation of text
    for line in systems_table.get_table().split('\n'):
        print(line)
예제 #8
0
def log_systems():
    universe = fo.get_universe()

    systems_table = Table(
        [Text('id'), Text('name'), Sequence('planets'), Sequence('connections'), Text('star')],
        table_name='System summary')
    for sid in fo.get_systems():
        system = universe.getSystem(sid)
        systems_table.add_row([
            sid, system.name, fo.sys_get_planets(sid), fo.sys_get_starlanes(sid), system.starType.name
        ])

    # Printing too much info at once will lead to truncation of text
    for line in systems_table.get_table().split('\n'):
        print line
예제 #9
0
def test_simple_table():
    t = Table(
        [
            Text("name", description="Name for first column"),
            Float("value", description="VValue"),
            Sequence("zzz"),
            Sequence("zzzzzzzzzzzzzzzzzz"),
        ],
        table_name="Wooho",
    )
    t.add_row(["hello", 144444, "abcffff", "a"])
    t.add_row([u"Plato aa\u03b2 III", 21, "de", "a"])
    t.add_row([u"Plato \u03b2 III", 21, "de", "a"])
    t.add_row(["Plato B III", 21, "d", "a"])
    t.add_row(["Plato Bddddd III", 21, "d", "a"])
    t.add_row(["Plato III", 21, "d", "a"])
    assert t.get_table() == EXPECTED_SIMPLE_TABLE