当前位置: 首页>>代码示例>>Python>>正文


Python group.Group类代码示例

本文整理汇总了Python中model.group.Group的典型用法代码示例。如果您正苦于以下问题:Python Group类的具体用法?Python Group怎么用?Python Group使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Group类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_modify_some_group

def test_modify_some_group(app, db, check_ui):
    if len(db.get_group_list()) == 0:
        app.group.create(Group(name='test'))
    old_groups = db.get_group_list()
    random_group = random.choice(old_groups)
    group = Group(name="update")
    group.id = random_group.id
    app.group.modify_group_by_id(group)
    new_groups = db.get_group_list()
    assert len(old_groups) == len(new_groups)
    i = 0
    for x in old_groups:
        if x.id == random_group.id:
            old_groups[i] = group
        i += 1
    assert old_groups == new_groups
    if check_ui:
        assert sorted(new_groups, key=Group.id_or_max) == sorted(app.group.get_group_list(), key=Group.id_or_max)


#def test_modify_group_header(app):
#    old_groups = app.group.get_group_list()
#    app.group.modify_first_group(Group(header="update"))
#    new_groups = app.group.get_group_list()
#    assert len(old_groups) == len(new_groups)
开发者ID:mynameisalexander,项目名称:python_training,代码行数:25,代码来源:test_modify_group.py

示例2: test_edit_group_name

def test_edit_group_name(app):
    if app.group.count() == 0:
        app.group.create(Group(name="test", header="test", footer="test"))
    old_groups = app.group.get_group_list()
    index = randrange(len(old_groups))
    group = Group(name="new")
    group.id = old_groups[index].id
    app.group.edit_group_by_index(index, group)
    new_groups = app.group.get_group_list()
    assert len(old_groups) == len(new_groups)
    old_groups[index]=group
    assert sorted(old_groups, key=Group.id_or_max) == sorted(new_groups, key=Group.id_or_max)


#def test_edit_group_header(app):
#    if app.group.count() == 0:
#        app.group.create(Group(name="test", header="test", footer="test"))
#    old_groups = app.group.get_group_list()
#    group = Group(header="new")
#    group.id = old_groups[0].id
#    app.group.edit_first_group(group)
#    new_groups = app.group.get_group_list()
#    assert len(old_groups) == len(new_groups)
#    old_groups[0]=group
#    assert sorted(old_groups, key=Group.id_or_max) == sorted(new_groups, key=Group.id_or_max)
开发者ID:marisly,项目名称:python_train,代码行数:25,代码来源:test_edit_group.py

示例3: test_modify_group

def test_modify_group(app, db, check_ui):
    if len(db.get_group_list()) == 0:
        test_group = Group()
        test_group.dummy()
        app.group.create(test_group)

    old_groups = db.get_group_list()

    group = random.choice(old_groups)

    test_group_new = Group(name = "random")
    test_group_new.id = group.id

    app.group.modify_by_id(group.id, test_group_new)

    new_groups = db.get_group_list()

    assert len(old_groups) == len(new_groups)

    old_groups[old_groups.index(group)] = test_group_new

    assert old_groups == new_groups

    if check_ui:
        assert sorted(map(clean, new_groups), key = Group.id_or_max) == \
            sorted(app.group.get_group_list(), key = Group.id_or_max)
开发者ID:alenickwork,项目名称:python_training,代码行数:26,代码来源:test_modify_group.py

示例4: get_groups

    def get_groups(self, uname):
        # get all groups for this user
        group = None
        user_groups = None
        try:
            collection = self.user_collection
            user_groups = collection.find_one({'_id':uname},{"groups":True})
        except Exception as inst:
            print "error reading groups"
            print inst

        if user_groups != None:
            
            group_cursor = user_groups["groups"]
            groups = []

            for item in group_cursor:
                print item
                group = Group()
                group.id = str(item["_id"])
                group.name = item["name"]
                group.hash = item["hash"]

                groups.append(group)

            return groups
        else:
            return None
开发者ID:nischalhp,项目名称:linkur,代码行数:28,代码来源:userDAO.py

示例5: insertExampleData

    def insertExampleData(self):
        self.getSession()
        g1 = Group("Group 1")
        g2 = Group("Group 2")
        g2.fav = True

        t1 = Track("Bob", "Hello World!", False, 1)
        t2 = Track("Joe", "How are you doing?", True, 3)
        t3 = Track("Jim", "Can't stop dancing", False, 5)
        t4 = Track("Tom", "A simple melody", True, 9)

        gt1_1 = GroupTrack(1, 0, 100)
        gt1_1.track = t1
        gt1_2 = GroupTrack(2, 100, 200)
        gt1_2.track = t2
        g1.grouptracks.append(gt1_1)
        g1.grouptracks.append(gt1_2)

        gt2_2 = GroupTrack(1, 0, 200)
        gt2_2.track = t2
        gt2_3 = GroupTrack(2, 200, 150)
        gt2_3.track = t3
        g2.grouptracks.append(gt2_2)
        g2.grouptracks.append(gt2_3)

        self.session.add_all([g1, g2, t1, t2, t3, t4, gt1_1, gt1_2, gt2_2, gt2_3])
        self.session.commit()
开发者ID:janhradek,项目名称:regaudio,代码行数:27,代码来源:model.py

示例6: test_modify_group_name

def test_modify_group_name(app):
    group = Group(name="To be modified")
    if app.group.count() == 0:
        app.group.create(Group(name="New group name"))
    old_groups = app.group.get_group_list()
    index = randrange(len(old_groups))
    group.id = old_groups[index].id
    app.group.modify_group_by_index(group, index)
    assert len(old_groups) == app.group.count()
    new_groups = app.group.get_group_list()
    old_groups[index] = group
    assert sorted(old_groups, key = Group.id_or_max) == sorted(new_groups, key = Group.id_or_max)

# def test_modify_group_header(app):
#     if app.group.count() == 0:
#         app.group.create(Group(header="To be modified"))
#     app.group.modify_first_group(Group(header="New group header"))
#     old_groups = app.group.get_group_list()
#     new_groups = app.group.get_group_list()
#     assert len(old_groups) == len(new_groups)
#
# def test_modify_group_footer(app):
#     if app.group.count() == 0:
#         app.group.create(Group(footer="To be modified"))
#     app.group.modify_first_group(Group(footer="New group footer"))
#     old_groups = app.group.get_group_list()
#     new_groups = app.group.get_group_list()
#     assert len(old_groups) == len(new_groups)
开发者ID:emalishenko,项目名称:python_training,代码行数:28,代码来源:test_group_modify.py

示例7: test_modify_gname

def test_modify_gname(app):
	old_groups = app.group.get_group_list()
	group = Group(name= 'New Group')
	group.id = old_groups[0].id
	app.group.modify_first_group(group)
	new_groups = app.group.get_group_list()
	assert len(old_groups) == len(new_groups)
	old_groups[0]= group
	assert  sorted(old_groups,key=Group.id_or_max) == sorted(new_groups,key=Group.id_or_max)
开发者ID:Alex-Chizhov,项目名称:python_training,代码行数:9,代码来源:test_modify_group.py

示例8: test_modify_group_name

def test_modify_group_name(app, db, check_ui):
    if app.group.count() == 0:
        app.group.create(Group(name="TestGroupName"))
    old_groups = db.get_group_list()
    old_group = random.choice(old_groups)
    group = Group(name="ModifyGroup")
    group.id = old_group.id
    old_groups.remove(old_group)
    app.group.modify_group_by_id(group)
    app.group.check_add_or_modify_success(db, group, old_groups, check_ui)
开发者ID:SvetlanaPopova,项目名称:python_1,代码行数:10,代码来源:test_modify_group.py

示例9: test_modify_group_name

def test_modify_group_name(app, orm):
    check_for_group(app)
    old_groups = orm.get_group_list()
    group = random.choice(old_groups)
    gr_obj = Group(name="popopo")
    gr_obj.id = group.id
    old_groups.remove(group)
    old_groups.append(gr_obj)
    app.group.modify_by_id(gr_obj)
    new_groups = orm.get_group_list()
    assert sorted(old_groups, key=Group.id_or_max) == sorted(new_groups, key=Group.id_or_max)
开发者ID:Dananas732,项目名称:python,代码行数:11,代码来源:test_mod_group.py

示例10: test_modify_group_name

def test_modify_group_name(app):
    if app.group.count() == 0:
        app.group.create(Group(name="testing"))
    old_groups = app.group.get_group_list()
    group = Group (name= "NewGroup")
    group.id = old_groups[0].id
    app.group.modify_first_group(group)
    new_groups = app.group.get_group_list()
    assert len(old_groups) == len (new_groups)
    old_groups[0]=group
    assert sorted(old_groups,key=Group.id_or_max) == sorted(new_groups,key=Group.id_or_max)
开发者ID:Manolaru,项目名称:Python_train,代码行数:11,代码来源:test_modify_group.py

示例11: test_modify_group_name

def test_modify_group_name(app):
   if app.group.count() == 0:
      app.group.create(Group(name="some name", header="some logo", footer="some footer"))
   old_groups = app.group.get_groups_list()
   index = randrange(len(old_groups))
   group = Group(name="new name")
   group.id = old_groups[index].id
   app.group.modify_group_by_index(index, group)
   new_groups = app.group.get_groups_list()
   assert len(old_groups) == len(new_groups)
   old_groups[index] = group
   assert sorted(old_groups, key=Group.id_or_max) == sorted(new_groups, key=Group.id_or_max)
开发者ID:silverlaurelin,项目名称:training,代码行数:12,代码来源:test_modify_group.py

示例12: test_edit_some_group_name

def test_edit_some_group_name(app):
    if app.group.count() ==0:
        app.group.create(Group(gr_name="for edit group"))
    old_groups = app.group.get_group_list()
    index = randrange(len(old_groups))
    group = Group(gr_name="edit_test111111")
    group.id = old_groups[index].id
    app.group.edit_group_by_index(index, group)
    new_groups = app.group.get_group_list()
    assert len(old_groups) == len(new_groups)
    old_groups[index] = group
    assert sorted(old_groups, key=Group.id_or_max) == sorted(new_groups, key=Group.id_or_max)
开发者ID:denis-nuzhdin,项目名称:test_py,代码行数:12,代码来源:test_edit_group.py

示例13: test_mod_some_group_name

def test_mod_some_group_name(app):
    if app.group.count() == 0:
        app.group.create(Group(name="test"))
    old_groups = app.group.get_group_list()
    index = randrange(len(old_groups))
    group = Group(name="new group")
    group.id = old_groups[index].id
    app.group.modify_group_by(group,index)
    new_groups = app.group.get_group_list()
    assert len(old_groups) == app.group.count()
    old_groups[index] = group
    assert sorted(old_groups, key=Group.id_or_max) == sorted(new_groups, key=Group.id_or_max)
开发者ID:YuliyaYaroshuk,项目名称:pythontrain,代码行数:12,代码来源:test_modify_group.py

示例14: test_edit_group_name

def test_edit_group_name(gen):
    if gen.group.count() == 0:
        gen.group.create(Group(name="test"))
    old_groups = gen.group.get_group_list()
    index = randrange(len(old_groups))
    group = Group(name="New name")
    group.id = old_groups[index].id
    gen.group.edit_group_by_index(index, group)
    assert len(old_groups) == gen.group.count()
    new_groups = gen.group.get_group_list()
    old_groups[index] = group
    assert sorted(old_groups, key=Group.id_or_max) == sorted(new_groups, key=Group.id_or_max)
开发者ID:sorael,项目名称:addressbook,代码行数:12,代码来源:test_edit_group.py

示例15: test_modify_some_group

def test_modify_some_group(app):
    group = Group(name="New group")
    if app.group.count() == 0:
        app.group.create(group)
    old_groups = app.group.get_group_list()
    index = randrange(len(old_groups))
    group.id = old_groups[index].id
    app.group.modify_group_by_index(index, group)
    assert len(old_groups) == app.group.count()
    new_groups = app.group.get_group_list()
    old_groups[index] = group
    assert sorted(old_groups, key=Group.id_or_max) == sorted(new_groups, key=Group.id_or_max)
开发者ID:aalekperov,项目名称:Task1,代码行数:12,代码来源:test_modify_group.py


注:本文中的model.group.Group类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。