Remove __slots__ to make it possible to inherit from Options classes.

This commit is contained in:
Aldo Cortesi 2013-03-03 12:26:20 +13:00
parent 75b5c97095
commit e608d10f45
4 changed files with 4 additions and 6 deletions

View File

@ -325,7 +325,7 @@ class ConsoleState(flow.State):
class Options(object):
__slots__ = [
attributes = [
"anticache",
"anticomp",
"client_replay",
@ -352,7 +352,7 @@ class Options(object):
def __init__(self, **kwargs):
for k, v in kwargs.items():
setattr(self, k, v)
for i in self.__slots__:
for i in self.attributes:
if not hasattr(self, i):
setattr(self, i, None)

View File

@ -21,7 +21,7 @@ class DumpError(Exception): pass
class Options(object):
__slots__ = [
attributes = [
"anticache",
"anticomp",
"client_replay",
@ -45,7 +45,7 @@ class Options(object):
def __init__(self, **kwargs):
for k, v in kwargs.items():
setattr(self, k, v)
for i in self.__slots__:
for i in self.attributes:
if not hasattr(self, i):
setattr(self, i, None)

View File

@ -101,7 +101,6 @@ class TestDumpMaster:
def test_options(self):
o = dump.Options(verbosity = 2)
assert o.verbosity == 2
libpry.raises(AttributeError, dump.Options, nonexistent = 2)
def test_filter(self):
assert not "GET" in self._dummy_cycle(1, "~u foo", "", verbosity=1)

View File

@ -146,4 +146,3 @@ class TestDummyServer:
d.start_slave()
d.shutdown()