mirror of
https://github.com/nikdoof/pyzkb.git
synced 2025-12-17 12:49:28 +00:00
Fix tests and raise exception if a non parameter modifier is supplied with an argument.
This commit is contained in:
@@ -80,6 +80,8 @@ class ZKillboard(object):
|
|||||||
raise InvalidModifier('%s is a unknown modifier' % mod_name)
|
raise InvalidModifier('%s is a unknown modifier' % mod_name)
|
||||||
if args is None and mod_name.lower() in ZKillboard._MODIFIERS_ARGUMENT:
|
if args is None and mod_name.lower() in ZKillboard._MODIFIERS_ARGUMENT:
|
||||||
raise InvalidModifier('%s requires a argument' % mod_name)
|
raise InvalidModifier('%s requires a argument' % mod_name)
|
||||||
|
if args and mod_name.lower() not in ZKillboard._MODIFIERS_ARGUMENT:
|
||||||
|
raise InvalidModifier('%s does not require an argument' % mod_name)
|
||||||
if args and isinstance(args, list) and len(args) > 10:
|
if args and isinstance(args, list) and len(args) > 10:
|
||||||
raise ValueError('No more than 10 IDs are allowed at a time')
|
raise ValueError('No more than 10 IDs are allowed at a time')
|
||||||
x = copy.deepcopy(self)
|
x = copy.deepcopy(self)
|
||||||
|
|||||||
@@ -57,9 +57,9 @@ class TestZKillboard(unittest.TestCase):
|
|||||||
self.assertTrue(len(x._modifiers) == 1)
|
self.assertTrue(len(x._modifiers) == 1)
|
||||||
|
|
||||||
def test_xml_format_set(self):
|
def test_xml_format_set(self):
|
||||||
self.kb.xml()
|
x = self.kb.xml()
|
||||||
self.assertTrue(len(self.kb._modifiers), 1)
|
self.assertTrue(len(x._modifiers), 1)
|
||||||
self.assertTrue(self.kb._xml_format)
|
self.assertTrue(x._xml_format)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user