示例#1
0
def test_team_of_eight():
    team = [
        'Happy', 'Dopey', 'Grumpy', 'Sneezy', 'Bashful', 'Sleepy', 'Doc',
        'Snow'
    ]
    groups = make_groups(team)

    assert len(groups) == 2
    assert membership_equal(team, groups)
示例#2
0
def test_team_of_eleven():
    team = [
        'Happy', 'Dopey', 'Grumpy', 'Sneezy', 'Bashful', 'Sleepy', 'Doc',
        'Snow', 'Clumsy', 'Wishy-Washy', 'Coughy'
    ]
    groups = make_groups(team)

    assert len(groups) == 3
    assert membership_equal(team, groups)
示例#3
0
def groups():
    """Generate groups for lunch."""
    roster = get_roster(True)

    if len(roster) < 3:
        click.echo(
            "Roster is currently less than three people. Please use the add command to add more folks."
        )
        return

    group_list = make_groups(roster)

    click.echo("\nLunch Groups")
    click.echo("------------")
    for i, group in enumerate(group_list):
        group_label = 'Group %d: ' % (i + 1)
        click.echo(group_label + ', '.join(group))
示例#4
0
def test_team_of_four():
    team = ['Happy', 'Dopey', 'Grumpy', 'Sneezy']
    groups = make_groups(team)

    assert len(groups) == 1
示例#5
0
def test_less_than_three_people():
    with pytest.raises(ValueError):
        make_groups(['Happy', 'Dopey'])
示例#6
0
def test_empty_team():
    with pytest.raises(ValueError):
        make_groups(None)
示例#7
0
def test_chinese_and_english_names():
    team = ['郭飛龍', 'Max Payne', '郭漢民', '龍存信', 'Johnny Cash', 'Martin Law']
    groups = make_groups(team)

    assert len(groups) == 2
    assert membership_equal(team, groups)
示例#8
0
def test_team_of_206():
    team = ['Name%d' % i for i in range(206)]
    groups = make_groups(team)

    assert len(groups) == 68
    assert membership_equal(team, groups)
示例#9
0
    duration = 2 + np.random.rand() * 8
    move(lamp, duration)


if __name__ == '__main__':
    lamp = JellyLamp(
        ids_groups=(
            (1, 2, 3, 4, 5, 6, 7, 8),
            (25, 26, 27, 28, 29, 30, 31, 32),
            (9, 10, 11, 12, 13, 14, 15, 16),
            (17, 18, 19, 20, 21, 22, 23, 24),
        ),
        sync_freq=100.0,
        offsets={},
    )
    make_groups(lamp)
    monitor = SafetyFirst(lamp)

    goto_rest_position(lamp)

    try:
        while True:
            breath(lamp)

            if np.random.rand() < 0.1:
                swim(lamp)

            if not monitor.is_everything_okay():
                goto_rest_position(lamp)
                lamp.disable_motors()