Did I find the right examples for you? yes no Crawl my project Python Jobs
All Samples(39) | Call(21) | Derive(0) | Import(18)
src/b/3/b3-1.9.2/b3/parsers/frostbite2/abstractParser.py b3(Download)
import b3.parser from b3.parsers.frostbite2.rcon import Rcon as FrostbiteRcon from b3.parsers.frostbite2.protocol import FrostbiteServer, CommandFailedError, CommandError, NetworkError from b3.parsers.frostbite2.util import PlayerInfoBlock, MapListBlock, BanlistContent import b3.events
src/b/i/big-brother-bot-HEAD/b3/parsers/frostbite2/abstractParser.py big-brother-bot(Download)
import b3.parser from b3.parsers.frostbite2.rcon import Rcon as FrostbiteRcon from b3.parsers.frostbite2.protocol import FrostbiteServer, CommandFailedError, CommandError, NetworkError from b3.parsers.frostbite2.util import PlayerInfoBlock, MapListBlock, BanlistContent import b3.events
src/b/3/b3-plugin-poweradminbf3-HEAD/extplugins/poweradminbf3.py b3-plugin-poweradminbf3(Download)
from b3.plugin import Plugin from ConfigParser import NoOptionError from b3.parsers.frostbite2.protocol import CommandFailedError from b3.parsers.frostbite2.util import MapListBlock, PlayerInfoBlock from b3.parsers.bf3 import GAME_MODES_NAMES, __version__ as bf3_version, GUNMASTER_WEAPONS_PRESET_BY_INDEX, GUNMASTER_WEAPONS_PRESET_BY_NAME
src/b/i/big-brother-bot-HEAD/tests/parsers/frostbite2/test_abstractParser.py big-brother-bot(Download)
from b3.plugins.admin import AdminPlugin from b3.config import XmlConfigParser from b3.parsers.frostbite2.protocol import CommandFailedError from b3.parsers.frostbite2.abstractParser import AbstractParser
offset = int(data[1]) except ValueError: raise CommandFailedError(['InvalidArguments']) # simulate that the Frostbite2 server responds with 5 maps at most for the mapList.list command maps_to_send = self.__class__.maps[offset:offset + 5]
offset = int(data[1]) except ValueError: raise CommandFailedError(['InvalidArguments']) # simulate that the Frostbite2 server responds with 5 bans at most for the banList.list command bans_to_send = self.__class__.bans[offset:offset + 5]
src/b/3/b3-plugin-poweradminbf3-HEAD/tests/test_load_server_config.py b3-plugin-poweradminbf3(Download)
import unittest from mock import Mock # http://www.voidspace.org.uk/python/mock/mock.html from b3.parsers.frostbite2.protocol import CommandFailedError from poweradminbf3 import Poweradminbf3Plugin
def test_read_cvars_with_error(self): self.console.write.side_effect = CommandFailedError('theError') self.p = self.p client = Mock() self.p.load_server_config(client, "theConfName", ("vars.withnoarg",))
def test_write_cvars_with_error(self): self.console.write.side_effect = CommandFailedError('theError') self.p = self.p client = Mock() self.p.load_server_config(client, "theConfName", ("vars.theCvar theValue",))
def my_write(*args): if len(args) and len(args[0]) and 'mapList.add' == args[0][0]: raise CommandFailedError('theError') return [] self.console.write.side_effect = my_write
src/b/3/b3-plugin-poweradminbf3-HEAD/tests/test_cmd_vipsave.py b3-plugin-poweradminbf3(Download)
# -*- encoding: utf-8 -*- from mockito import when from b3.config import CfgConfigParser from b3.parsers.frostbite2.protocol import CommandFailedError from poweradminbf3 import Poweradminbf3Plugin
def test_frostbite_error(self): when(self.console).write(('reservedSlotsList.list', 0)).thenReturn([]) when(self.console).write(('reservedSlotsList.save',)).thenRaise(CommandFailedError(['f00'])) self.moderator.connects("moderator") self.moderator.message_history = []
src/b/3/b3-plugin-poweradminbf3-HEAD/tests/test_cmd_vipremove.py b3-plugin-poweradminbf3(Download)
# -*- encoding: utf-8 -*- # http://www.voidspace.org.uk/python/mock/mock.html from mockito import when, verify from b3.config import CfgConfigParser from b3.parsers.frostbite2.protocol import CommandFailedError
def test_frostbite_error(self): self.joe.connects("joe") self.superadmin.connects('superadmin') when(self.console).write(('reservedSlotsList.remove', u'Joe')).thenRaise(CommandFailedError(['f00'])) self.superadmin.clearMessageHistory()
def test_frostbite_error_PlayerNotInList(self): self.joe.connects("joe") self.superadmin.connects('superadmin') when(self.console).write(('reservedSlotsList.remove', u'Joe')).thenRaise(CommandFailedError(['PlayerNotInList'])) self.superadmin.clearMessageHistory()
src/b/3/b3-plugin-poweradminbf3-HEAD/tests/test_cmd_vipload.py b3-plugin-poweradminbf3(Download)
# -*- encoding: utf-8 -*- from mockito import when from b3.config import CfgConfigParser from b3.parsers.frostbite2.protocol import CommandFailedError from poweradminbf3 import Poweradminbf3Plugin
def test_frostbite_error(self): when(self.console).write(('reservedSlotsList.load',)).thenRaise(CommandFailedError(['f00'])) self.moderator.connects("moderator") self.moderator.message_history = [] self.moderator.says("!vipload")
src/b/3/b3-plugin-poweradminbf3-HEAD/tests/test_cmd_vipclear.py b3-plugin-poweradminbf3(Download)
# -*- encoding: utf-8 -*- from mockito import when from b3.config import CfgConfigParser from b3.parsers.frostbite2.protocol import CommandFailedError from poweradminbf3 import Poweradminbf3Plugin
def test_frostbite_error(self): when(self.console).write(('reservedSlotsList.clear',)).thenRaise(CommandFailedError(['f00'])) self.moderator.connects("moderator") self.moderator.message_history = [] self.moderator.says("!vipclear")
src/b/3/b3-plugin-poweradminbf3-HEAD/tests/test_cmd_vipadd.py b3-plugin-poweradminbf3(Download)
# -*- encoding: utf-8 -*- # http://www.voidspace.org.uk/python/mock/mock.html from mockito import when, verify from b3.config import CfgConfigParser from b3.parsers.frostbite2.protocol import CommandFailedError
def test_frostbite_error(self): self.joe.connects("joe") self.superadmin.connects('superadmin') when(self.console).write(('reservedSlotsList.add', 'Joe')).thenRaise(CommandFailedError(['f00'])) self.superadmin.clearMessageHistory()
1 | 2 Next