uncomment more test

This commit is contained in:
Emmanuel Garette 2014-04-14 23:00:37 +02:00
parent 9bec52273a
commit 7c8164090a
2 changed files with 229 additions and 237 deletions

View file

@ -7,77 +7,71 @@ from tiramisu.option import BoolOption, IntOption, OptionDescription
import weakref import weakref
#def test_deref_storage(): def test_deref_storage():
# b = BoolOption('b', '') b = BoolOption('b', '')
# o = OptionDescription('od', '', [b]) o = OptionDescription('od', '', [b])
# c = Config(o) c = Config(o)
# w = weakref.ref(c.cfgimpl_get_values()._p_) w = weakref.ref(c.cfgimpl_get_values()._p_)
# del(c) del(c)
# assert w() is None assert w() is None
#
#
#def test_deref_value():
# b = BoolOption('b', '')
# o = OptionDescription('od', '', [b])
# c = Config(o)
# w = weakref.ref(c.cfgimpl_get_values())
# del(c)
# assert w() is None
#
#
#def test_deref_setting():
# b = BoolOption('b', '')
# o = OptionDescription('od', '', [b])
# c = Config(o)
# w = weakref.ref(c.cfgimpl_get_settings())
# del(c)
# assert w() is None
#
#
#def test_deref_config():
# b = BoolOption('b', '')
# o = OptionDescription('od', '', [b])
# c = Config(o)
# w = weakref.ref(c)
# del(c)
# assert w() is None
#
#
#def test_deref_option():
# b = BoolOption('b', '')
# o = OptionDescription('od', '', [b])
# w = weakref.ref(b)
# del(b)
# assert w() is not None
# del(o)
# #FIXME
# #assert w() is None
#
#
#def test_deref_optiondescription():
# b = BoolOption('b', '')
# o = OptionDescription('od', '', [b])
# w = weakref.ref(o)
# del(b)
# assert w() is not None
# del(o)
# #FIXME
# #assert w() is None
#def test_deref_option_cache(): def test_deref_value():
# FIXME quand c'est un dico, il faut garder la reference b = BoolOption('b', '')
# mais la comme c'est dans la base, forcement c'est dereference o = OptionDescription('od', '', [b])
# b = BoolOption('b', '') c = Config(o)
# o = OptionDescription('od', '', [b]) w = weakref.ref(c.cfgimpl_get_values())
# o.impl_build_cache_option() del(c)
# w = weakref.ref(b) assert w() is None
# del(b)
# assert w() is not None
# del(o) def test_deref_setting():
# #FIXME l'objet n'est plus en mémoire mais par contre reste dans la base b = BoolOption('b', '')
# #Voir comment supprimer (et quand) o = OptionDescription('od', '', [b])
# #assert w() is None c = Config(o)
w = weakref.ref(c.cfgimpl_get_settings())
del(c)
assert w() is None
def test_deref_config():
b = BoolOption('b', '')
o = OptionDescription('od', '', [b])
c = Config(o)
w = weakref.ref(c)
del(c)
assert w() is None
def test_deref_option():
b = BoolOption('b', '')
o = OptionDescription('od', '', [b])
w = weakref.ref(b)
del(b)
assert w() is not None
del(o)
assert w() is None
def test_deref_optiondescription():
b = BoolOption('b', '')
o = OptionDescription('od', '', [b])
w = weakref.ref(o)
del(b)
assert w() is not None
del(o)
assert w() is None
def test_deref_option_cache():
b = BoolOption('b', '')
o = OptionDescription('od', '', [b])
o.impl_build_cache_option()
w = weakref.ref(b)
del(b)
assert w() is not None
del(o)
assert w() is None
def test_deref_optiondescription_cache(): def test_deref_optiondescription_cache():
@ -88,22 +82,20 @@ def test_deref_optiondescription_cache():
del(b) del(b)
assert w() is not None assert w() is not None
del(o) del(o)
#FIXME assert w() is None
#assert w() is None
#def test_deref_option_config(): def test_deref_option_config():
# b = BoolOption('b', '') b = BoolOption('b', '')
# o = OptionDescription('od', '', [b]) o = OptionDescription('od', '', [b])
# c = Config(o) c = Config(o)
# w = weakref.ref(b) w = weakref.ref(b)
# del(b) del(b)
# assert w() is not None assert w() is not None
# del(o) del(o)
# assert w() is not None assert w() is not None
# del(c) del(c)
# #FIXME meme chose assert w() is None
# #assert w() is None
#FIXME rien a voir mais si je fais un config.impl_get_path_by_opt() ca me retourne la methode ! #FIXME rien a voir mais si je fais un config.impl_get_path_by_opt() ca me retourne la methode !

View file

@ -9,157 +9,157 @@ from tiramisu.option import ChoiceOption, BoolOption, IntOption, FloatOption,\
URLOption, FilenameOption URLOption, FilenameOption
#def test_slots_option(): def test_slots_option():
# c = ChoiceOption('a', '', ('a',)) c = ChoiceOption('a', '', ('a',))
# raises(AttributeError, "c.x = 1") raises(AttributeError, "c.x = 1")
# c = BoolOption('a', '') c = BoolOption('a', '')
# raises(AttributeError, "c.x = 1") raises(AttributeError, "c.x = 1")
# c = IntOption('a', '') c = IntOption('a', '')
# raises(AttributeError, "c.x = 1") raises(AttributeError, "c.x = 1")
# c = FloatOption('a', '') c = FloatOption('a', '')
# raises(AttributeError, "c.x = 1") raises(AttributeError, "c.x = 1")
# c = StrOption('a', '') c = StrOption('a', '')
# raises(AttributeError, "c.x = 1") raises(AttributeError, "c.x = 1")
# c = SymLinkOption('b', c) c = SymLinkOption('b', c)
# raises(AttributeError, "c.x = 1") raises(AttributeError, "c.x = 1")
# c = UnicodeOption('a', '') c = UnicodeOption('a', '')
# raises(AttributeError, "c.x = 1") raises(AttributeError, "c.x = 1")
# c = IPOption('a', '') c = IPOption('a', '')
# raises(AttributeError, "c.x = 1") raises(AttributeError, "c.x = 1")
# c = OptionDescription('a', '', []) c = OptionDescription('a', '', [])
# raises(AttributeError, "c.x = 1") raises(AttributeError, "c.x = 1")
# c = PortOption('a', '') c = PortOption('a', '')
# raises(AttributeError, "c.x = 1") raises(AttributeError, "c.x = 1")
# c = NetworkOption('a', '') c = NetworkOption('a', '')
# raises(AttributeError, "c.x = 1") raises(AttributeError, "c.x = 1")
# c = NetmaskOption('a', '') c = NetmaskOption('a', '')
# raises(AttributeError, "c.x = 1") raises(AttributeError, "c.x = 1")
# c = DomainnameOption('a', '') c = DomainnameOption('a', '')
# raises(AttributeError, "c.x = 1") raises(AttributeError, "c.x = 1")
# c = EmailOption('a', '') c = EmailOption('a', '')
# raises(AttributeError, "c.x = 1") raises(AttributeError, "c.x = 1")
# c = URLOption('a', '') c = URLOption('a', '')
# raises(AttributeError, "c.x = 1") raises(AttributeError, "c.x = 1")
# c = FilenameOption('a', '') c = FilenameOption('a', '')
# raises(AttributeError, "c.x = 1") raises(AttributeError, "c.x = 1")
#
#
#def test_slots_option_readonly(): def test_slots_option_readonly():
# a = ChoiceOption('a', '', ('a',)) a = ChoiceOption('a', '', ('a',))
# b = BoolOption('b', '') b = BoolOption('b', '')
# c = IntOption('c', '') c = IntOption('c', '')
# d = FloatOption('d', '') d = FloatOption('d', '')
# e = StrOption('e', '') e = StrOption('e', '')
# g = UnicodeOption('g', '') g = UnicodeOption('g', '')
# h = IPOption('h', '') h = IPOption('h', '')
# i = PortOption('i', '') i = PortOption('i', '')
# j = NetworkOption('j', '') j = NetworkOption('j', '')
# k = NetmaskOption('k', '') k = NetmaskOption('k', '')
# l = DomainnameOption('l', '') l = DomainnameOption('l', '')
# o = EmailOption('o', '') o = EmailOption('o', '')
# p = URLOption('p', '') p = URLOption('p', '')
# q = FilenameOption('q', '') q = FilenameOption('q', '')
# m = OptionDescription('m', '', [a, b, c, d, e, g, h, i, j, k, l, o, p, q]) m = OptionDescription('m', '', [a, b, c, d, e, g, h, i, j, k, l, o, p, q])
# a._requires = 'a' a._requires = 'a'
# b._requires = 'b' b._requires = 'b'
# c._requires = 'c' c._requires = 'c'
# d._requires = 'd' d._requires = 'd'
# e._requires = 'e' e._requires = 'e'
# g._requires = 'g' g._requires = 'g'
# h._requires = 'h' h._requires = 'h'
# i._requires = 'i' i._requires = 'i'
# j._requires = 'j' j._requires = 'j'
# k._requires = 'k' k._requires = 'k'
# l._requires = 'l' l._requires = 'l'
# m._requires = 'm' m._requires = 'm'
# o._requires = 'o' o._requires = 'o'
# p._requires = 'p' p._requires = 'p'
# q._requires = 'q' q._requires = 'q'
# Config(m) Config(m)
# raises(AttributeError, "a._requires = 'a'") raises(AttributeError, "a._requires = 'a'")
# raises(AttributeError, "b._requires = 'b'") raises(AttributeError, "b._requires = 'b'")
# raises(AttributeError, "c._requires = 'c'") raises(AttributeError, "c._requires = 'c'")
# raises(AttributeError, "d._requires = 'd'") raises(AttributeError, "d._requires = 'd'")
# raises(AttributeError, "e._requires = 'e'") raises(AttributeError, "e._requires = 'e'")
# raises(AttributeError, "g._requires = 'g'") raises(AttributeError, "g._requires = 'g'")
# raises(AttributeError, "h._requires = 'h'") raises(AttributeError, "h._requires = 'h'")
# raises(AttributeError, "i._requires = 'i'") raises(AttributeError, "i._requires = 'i'")
# raises(AttributeError, "j._requires = 'j'") raises(AttributeError, "j._requires = 'j'")
# raises(AttributeError, "k._requires = 'k'") raises(AttributeError, "k._requires = 'k'")
# raises(AttributeError, "l._requires = 'l'") raises(AttributeError, "l._requires = 'l'")
# raises(AttributeError, "m._requires = 'm'") raises(AttributeError, "m._requires = 'm'")
# raises(AttributeError, "o._requires = 'o'") raises(AttributeError, "o._requires = 'o'")
# raises(AttributeError, "p._requires = 'p'") raises(AttributeError, "p._requires = 'p'")
# raises(AttributeError, "q._requires = 'q'") raises(AttributeError, "q._requires = 'q'")
#
#
#def test_slots_option_readonly_name(): def test_slots_option_readonly_name():
# a = ChoiceOption('a', '', ('a',)) a = ChoiceOption('a', '', ('a',))
# b = BoolOption('b', '') b = BoolOption('b', '')
# c = IntOption('c', '') c = IntOption('c', '')
# d = FloatOption('d', '') d = FloatOption('d', '')
# e = StrOption('e', '') e = StrOption('e', '')
# f = SymLinkOption('f', c) f = SymLinkOption('f', c)
# g = UnicodeOption('g', '') g = UnicodeOption('g', '')
# h = IPOption('h', '') h = IPOption('h', '')
# i = PortOption('i', '') i = PortOption('i', '')
# j = NetworkOption('j', '') j = NetworkOption('j', '')
# k = NetmaskOption('k', '') k = NetmaskOption('k', '')
# l = DomainnameOption('l', '') l = DomainnameOption('l', '')
# o = DomainnameOption('o', '') o = DomainnameOption('o', '')
# p = DomainnameOption('p', '') p = DomainnameOption('p', '')
# q = DomainnameOption('q', '') q = DomainnameOption('q', '')
# m = OptionDescription('m', '', [a, b, c, d, e, f, g, h, i, j, k, l, o, p, q]) m = OptionDescription('m', '', [a, b, c, d, e, f, g, h, i, j, k, l, o, p, q])
# raises(AttributeError, "a._name = 'a'") raises(AttributeError, "a._name = 'a'")
# raises(AttributeError, "b._name = 'b'") raises(AttributeError, "b._name = 'b'")
# raises(AttributeError, "c._name = 'c'") raises(AttributeError, "c._name = 'c'")
# raises(AttributeError, "d._name = 'd'") raises(AttributeError, "d._name = 'd'")
# raises(AttributeError, "e._name = 'e'") raises(AttributeError, "e._name = 'e'")
# raises(AttributeError, "f._name = 'f'") raises(AttributeError, "f._name = 'f'")
# raises(AttributeError, "g._name = 'g'") raises(AttributeError, "g._name = 'g'")
# raises(AttributeError, "h._name = 'h'") raises(AttributeError, "h._name = 'h'")
# raises(AttributeError, "i._name = 'i'") raises(AttributeError, "i._name = 'i'")
# raises(AttributeError, "j._name = 'j'") raises(AttributeError, "j._name = 'j'")
# raises(AttributeError, "k._name = 'k'") raises(AttributeError, "k._name = 'k'")
# raises(AttributeError, "l._name = 'l'") raises(AttributeError, "l._name = 'l'")
# raises(AttributeError, "m._name = 'm'") raises(AttributeError, "m._name = 'm'")
# raises(AttributeError, "o._name = 'o'") raises(AttributeError, "o._name = 'o'")
# raises(AttributeError, "p._name = 'p'") raises(AttributeError, "p._name = 'p'")
# raises(AttributeError, "q._name = 'q'") raises(AttributeError, "q._name = 'q'")
#
#
##def test_slots_description(): #def test_slots_description():
## # __slots__ for OptionDescription should be complete for __getattr__ # # __slots__ for OptionDescription should be complete for __getattr__
## slots = set() # slots = set()
## for subclass in OptionDescription.__mro__: # for subclass in OptionDescription.__mro__:
## if subclass is not object: # if subclass is not object:
## slots.update(subclass.__slots__) # slots.update(subclass.__slots__)
## assert slots == set(OptionDescription.__slots__) # assert slots == set(OptionDescription.__slots__)
#
#
#def test_slots_config(): def test_slots_config():
# od1 = OptionDescription('a', '', []) od1 = OptionDescription('a', '', [])
# od2 = OptionDescription('a', '', [od1]) od2 = OptionDescription('a', '', [od1])
# c = Config(od2) c = Config(od2)
# raises(AttributeError, "c.x = 1") raises(AttributeError, "c.x = 1")
# raises(AttributeError, "c.cfgimpl_x = 1") raises(AttributeError, "c.cfgimpl_x = 1")
# sc = c.a sc = c.a
# assert isinstance(sc, SubConfig) assert isinstance(sc, SubConfig)
# raises(AttributeError, "sc.x = 1") raises(AttributeError, "sc.x = 1")
# raises(AttributeError, "sc.cfgimpl_x = 1") raises(AttributeError, "sc.cfgimpl_x = 1")
#
#
#def test_slots_setting(): def test_slots_setting():
# od1 = OptionDescription('a', '', []) od1 = OptionDescription('a', '', [])
# od2 = OptionDescription('a', '', [od1]) od2 = OptionDescription('a', '', [od1])
# c = Config(od2) c = Config(od2)
# s = c.cfgimpl_get_settings() s = c.cfgimpl_get_settings()
# raises(AttributeError, "s.x = 1") raises(AttributeError, "s.x = 1")
#
#
#def test_slots_value(): def test_slots_value():
# od1 = OptionDescription('a', '', []) od1 = OptionDescription('a', '', [])
# od2 = OptionDescription('a', '', [od1]) od2 = OptionDescription('a', '', [od1])
# c = Config(od2) c = Config(od2)
# v = c.cfgimpl_get_values() v = c.cfgimpl_get_values()
# raises(AttributeError, "v.x = 1") raises(AttributeError, "v.x = 1")