• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python helpers.get_word_post_data函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_has_meaning__duplicate

    def test_has_meaning__duplicate(self):
        self.assertEqual(Building.objects.all().count(), 0)

        VotePrototype.create(self.account2, self.bill, False)
        VotePrototype.create(self.account3, self.bill, True)

        noun = names.generator.get_test_name('building-name')
        data = linguistics_helpers.get_word_post_data(noun, prefix='name')
        data.update({'approved': True})

        form = BuildingCreate.ModeratorForm(data)

        self.assertTrue(form.is_valid())
        self.bill.update_by_moderator(form)
        self.assertTrue(self.bill.apply())

        dup_noun = names.generator.get_test_name('dup-building-name')
        data = linguistics_helpers.get_word_post_data(dup_noun, prefix='name')
        data.update({'approved': True})

        form = BuildingCreate.ModeratorForm(data)

        bill = BillPrototype.get_by_id(self.bill.id)
        bill.state = BILL_STATE.VOTING
        bill.save()

        self.assertTrue(form.is_valid())
        bill.update_by_moderator(form)

        self.assertFalse(bill.has_meaning())
开发者ID:alexudracul,项目名称:the-tale,代码行数:30,代码来源:test_building_create.py


示例2: test_apply

    def test_apply(self):
        self.assertEqual(Building.objects.all().count(), 0)

        VotePrototype.create(self.account2, self.bill, False)
        VotePrototype.create(self.account3, self.bill, True)

        noun = names.generator.get_test_name('r-building-name')

        data = linguistics_helpers.get_word_post_data(noun, prefix='name')
        data.update({'approved': True})

        form = BuildingCreate.ModeratorForm(data)

        self.assertTrue(form.is_valid())
        self.bill.update_by_moderator(form)

        self.assertTrue(self.bill.apply())

        bill = BillPrototype.get_by_id(self.bill.id)
        self.assertTrue(bill.state.is_ACCEPTED)

        self.assertEqual(Building.objects.all().count(), 1)

        building = buildings_storage.all()[0]

        self.assertEqual(building.person.id, self.person_1.id)
        self.assertEqual(building.place.id, self.place1.id)
        self.assertEqual(building.utg_name, noun)
开发者ID:alexudracul,项目名称:the-tale,代码行数:28,代码来源:test_building_create.py


示例3: setUp

    def setUp(self):
        super(BillPlaceRenamingTests, self).setUp()

        bill_data = bills.PlaceRenaming(place_id=self.place1.id, name_forms=names.generator.get_test_name('new-name'))
        self.bill = BillPrototype.create(self.account1, 'bill-caption', 'bill-rationale', bill_data, chronicle_on_accepted='chronicle-on-accepted')

        data = linguistics_helpers.get_word_post_data(bill_data.name_forms, prefix='name')
        data.update({'approved': True})
        self.form = bills.PlaceRenaming.ModeratorForm(data)
        self.assertTrue(self.form.is_valid())
开发者ID:Alkalit,项目名称:the-tale,代码行数:10,代码来源:test_signals.py


示例4: post_data

 def post_data(self):
     data = {'description': 'new-description',
             'type': relations.TYPE.random(),
             'max_health': 650,
             'dedication': relations.DEDICATION.random(),
             'archetype': game_relations.ARCHETYPE.random(),
             'mode': relations.MODE.random()}
     data.update(linguistics_helpers.get_word_post_data(names.generator.get_test_name(name='new_name'), prefix='name'))
     data.update(helpers.get_abilities_post_data(helpers.FAKE_ABILITIES_CONTAINER_2),)
     return data
开发者ID:Alkalit,项目名称:the-tale,代码行数:10,代码来源:test_requests.py


示例5: test_create__with_parent__full_copy

    def test_create__with_parent__full_copy(self):
        for word_type in utg_relations.WORD_TYPE.records:
            word = utg_words.Word.create_test_word(word_type)

            parent = prototypes.WordPrototype.create(word)
            parent.state = relations.WORD_STATE.IN_GAME
            parent.save()

            requested_url = url('linguistics:words:create', type=word_type.value, parent=parent.id)

            with self.check_not_changed(prototypes.WordPrototype._db_count):
                self.check_ajax_error(self.client.post(requested_url, helpers.get_word_post_data(parent.utg_word)),
                                      'linguistics.words.create.full_copy_restricted')
开发者ID:Alkalit,项目名称:the-tale,代码行数:13,代码来源:test_words_requests.py


示例6: test_create__parent_not_cpecified

    def test_create__parent_not_cpecified(self):
        for word_type in utg_relations.WORD_TYPE.records:
            word = utg_words.Word.create_test_word(word_type)

            parent = prototypes.WordPrototype.create(word)
            parent.state = random.choice(relations.WORD_STATE.records)
            parent.save()

            requested_url = url('linguistics:words:create', type=word_type.value)

            with self.check_delta(prototypes.WordPrototype._db_count, 0):
                self.check_ajax_error(self.client.post(requested_url, helpers.get_word_post_data(word)),
                                      'linguistics.words.create.parent_exists')
开发者ID:Alkalit,项目名称:the-tale,代码行数:13,代码来源:test_words_requests.py


示例7: test_create_with_all_fields

    def test_create_with_all_fields(self):
        for word_type in utg_relations.WORD_TYPE.records:
            word = utg_words.Word.create_test_word(word_type, prefix='w-')
            requested_url = url('linguistics:words:create', type=word_type.value)

            with self.check_delta(prototypes.WordPrototype._db_count, 1):
                response = self.client.post(requested_url, helpers.get_word_post_data(word))

            last_prototype = prototypes.WordPrototype._db_latest()

            self.check_ajax_ok(response, data={'next_url': url('linguistics:words:show', last_prototype.id)})

            self.assertEqual(word, last_prototype.utg_word)
开发者ID:Alkalit,项目名称:the-tale,代码行数:13,代码来源:test_words_requests.py


示例8: post_data

 def post_data(self):
     data = {'description': 'new-description',
             'type': game_relations.BEING_TYPE.random(),
             'max_health': 650,
             'dedication': relations.DEDICATION.random(),
             'archetype': game_relations.ARCHETYPE.random(),
             'mode': relations.MODE.random(),
             'communication_verbal': game_relations.COMMUNICATION_VERBAL.CAN,
             'communication_gestures': game_relations.COMMUNICATION_GESTURES.CAN,
             'communication_telepathic': game_relations.COMMUNICATION_TELEPATHIC.CAN,
             'intellect_level': game_relations.INTELLECT_LEVEL.NORMAL}
     data.update(linguistics_helpers.get_word_post_data(names.generator.get_test_name(name='new_name'), prefix='name'))
     data.update(helpers.get_abilities_post_data(helpers.FAKE_ABILITIES_CONTAINER_2),)
     return data
开发者ID:alexudracul,项目名称:the-tale,代码行数:14,代码来源:test_requests.py


示例9: get_create_data

    def get_create_data(self):
        word = names.generator.get_test_name(name='mob name')

        data = linguistics_helpers.get_word_post_data(word, prefix='name')

        data.update( { 'level': 666,
                'terrains': [TERRAIN.PLANE_GRASS, TERRAIN.HILLS_GRASS],
                'abilities': ['hit', 'strong_hit', 'sidestep'],
                'type': MOB_TYPE.CIVILIZED,
                'archetype': game_relations.ARCHETYPE.NEUTRAL,
                'global_action_probability': 0.5,
                'description': 'mob description'} )

        return data
开发者ID:Alkalit,项目名称:the-tale,代码行数:14,代码来源:test_request.py


示例10: test_has_meaning__duplicate_name

    def test_has_meaning__duplicate_name(self):
        VotePrototype.create(self.account2, self.bill, False)
        VotePrototype.create(self.account3, self.bill, True)

        new_name = names.generator.get_test_name('new-new-name')
        self.bill.data.place.set_utg_name(new_name)

        data = linguistics_helpers.get_word_post_data(new_name, prefix='name')
        data.update({'approved': True})
        form = PlaceRenaming.ModeratorForm(data)
        self.assertTrue(form.is_valid())
        self.bill.update_by_moderator(form)

        self.assertFalse(self.bill.has_meaning())
开发者ID:alexudracul,项目名称:the-tale,代码行数:14,代码来源:test_place_renaming.py


示例11: get_update_data

    def get_update_data(self):
        word = names.generator.get_test_name(name='new name')

        data = linguistics_helpers.get_word_post_data(word, prefix='name')

        data.update( {'level': 667,
                'terrains': [TERRAIN.PLANE_JUNGLE, TERRAIN.HILLS_JUNGLE],
                'abilities': ['hit', 'speedup'],
                'type': MOB_TYPE.BARBARIAN,
                'archetype': game_relations.ARCHETYPE.MAGICAL,
                'global_action_probability': 0.1,
                'description': 'new description'})

        return data
开发者ID:Alkalit,项目名称:the-tale,代码行数:14,代码来源:test_request.py


示例12: get_form_data

    def get_form_data(self):
        mob = prototypes.MobRecordPrototype.create_random(uuid='bandit', state=relations.MOB_RECORD_STATE.DISABLED)

        data = linguistics_helpers.get_word_post_data(mob.utg_name, prefix='name')

        data.update( { 'level': str(mob.level),
                       'global_action_probability': '0.25',
                       'terrains': ['TERRAIN.PLANE_GRASS', 'TERRAIN.HILLS_GRASS'],
                       'abilities': ['hit', 'strong_hit', 'sidestep'],
                       'type': 'MOB_TYPE.CIVILIZED',
                       'archetype': 'ARCHETYPE.NEUTRAL',
                       'description': mob.description} )

        return data
开发者ID:Alkalit,项目名称:the-tale,代码行数:14,代码来源:test_form.py


示例13: get_create_data

    def get_create_data(self, mob=None):
        word = names.generator.get_test_name(name='artifact')
        data = linguistics_helpers.get_word_post_data(word, prefix='name')

        data.update({
                'level': 1,
                'type': relations.ARTIFACT_TYPE.RING,
                'power_type': relations.ARTIFACT_POWER_TYPE.NEUTRAL,
                'rare_effect': relations.ARTIFACT_EFFECT.POISON,
                'epic_effect': relations.ARTIFACT_EFFECT.GREAT_PHYSICAL_DAMAGE,
                'special_effect': relations.ARTIFACT_EFFECT.NO_EFFECT,
                'description': 'artifact description',
                'mob':  u'' if mob is None else mob.id})

        return data
开发者ID:Alkalit,项目名称:the-tale,代码行数:15,代码来源:test_requests.py


示例14: get_update_data

    def get_update_data(self, mob=None):
        word = names.generator.get_test_name(name='new name')
        data = linguistics_helpers.get_word_post_data(word, prefix='name')

        data.update({
                'level': 2,
                'type': relations.ARTIFACT_TYPE.AMULET,
                'power_type': relations.ARTIFACT_POWER_TYPE.MAGICAL,
                'rare_effect': relations.ARTIFACT_EFFECT.NO_EFFECT,
                'epic_effect': relations.ARTIFACT_EFFECT.POISON,
                'special_effect': relations.ARTIFACT_EFFECT.CHILD_GIFT,
                'description': 'new artifact description',
                'mob': u'' if mob is None else mob.id})

        return data
开发者ID:Alkalit,项目名称:the-tale,代码行数:15,代码来源:test_requests.py


示例15: test_update

    def test_update(self):
        data = linguistics_helpers.get_word_post_data(names.generator.get_test_name('new-building-name'), prefix='name')
        data.update({'caption': 'new-caption',
                     'rationale': 'new-rationale',
                     'chronicle_on_accepted': 'chronicle-on-accepted',
                     'person': self.person_2.id })

        form = self.bill.data.get_user_form_update(post=data)
        self.assertTrue(form.is_valid())

        self.bill.update(form)

        self.bill = BillPrototype.get_by_id(self.bill.id)

        self.assertEqual(self.bill.data.person_id, self.person_2.id)
        self.assertEqual(self.bill.data.base_name, u'new-building-name-нс,ед,им')
开发者ID:alexudracul,项目名称:the-tale,代码行数:16,代码来源:test_building_create.py


示例16: test_can_not_replace_onreview_word_from_another_author

    def test_can_not_replace_onreview_word_from_another_author(self):
        for word_type in utg_relations.WORD_TYPE.records:
            parent_word = utg_words.Word.create_test_word(word_type, prefix=u'parent-')
            child_word = utg_words.Word.create_test_word(word_type, prefix=u'child-')

            parent = prototypes.WordPrototype.create(parent_word, author=self.account_2)

            requested_url = url('linguistics:words:create', type=word_type.value, parent=parent.id)

            with self.check_delta(prototypes.WordPrototype._db_count, 0):
                self.check_ajax_error(self.client.post(requested_url, helpers.get_word_post_data(child_word)),
                                      'linguistics.words.create.can_not_edit_anothers_word')

            last_prototype = prototypes.WordPrototype._db_latest()

            self.assertEqual(parent.created_at, last_prototype.created_at)
            self.assertEqual(parent_word, last_prototype.utg_word)
开发者ID:Alkalit,项目名称:the-tale,代码行数:17,代码来源:test_words_requests.py


示例17: get_update_data

    def get_update_data(self, mob=None):
        word = names.generator().get_test_name(name="new name")
        data = linguistics_helpers.get_word_post_data(word, prefix="name")

        data.update(
            {
                "level": 2,
                "type": relations.ARTIFACT_TYPE.AMULET,
                "power_type": relations.ARTIFACT_POWER_TYPE.MAGICAL,
                "rare_effect": relations.ARTIFACT_EFFECT.NO_EFFECT,
                "epic_effect": relations.ARTIFACT_EFFECT.POISON,
                "special_effect": relations.ARTIFACT_EFFECT.CHILD_GIFT,
                "description": "new artifact description",
                "mob": "" if mob is None else mob.id,
            }
        )

        return data
开发者ID:Tiendil,项目名称:the-tale,代码行数:18,代码来源:test_requests.py


示例18: get_create_data

    def get_create_data(self, mob=None):
        word = names.generator().get_test_name(name="artifact")
        data = linguistics_helpers.get_word_post_data(word, prefix="name")

        data.update(
            {
                "level": 1,
                "type": relations.ARTIFACT_TYPE.RING,
                "power_type": relations.ARTIFACT_POWER_TYPE.NEUTRAL,
                "rare_effect": relations.ARTIFACT_EFFECT.POISON,
                "epic_effect": relations.ARTIFACT_EFFECT.GREAT_PHYSICAL_DAMAGE,
                "special_effect": relations.ARTIFACT_EFFECT.NO_EFFECT,
                "description": "artifact description",
                "mob": "" if mob is None else mob.id,
            }
        )

        return data
开发者ID:Tiendil,项目名称:the-tale,代码行数:18,代码来源:test_requests.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python theano._asarray函数代码示例发布时间:2022-05-27
下一篇:
Python prototypes.Battle1x1Prototype类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap