def test_relist_setitem(): """options._ReList.__setitem__: adds value as expected""" canary = re.compile('bar') test = options._ReList([canary]) test[0] = 'foo' nt.ok_(test[0] is not canary, msg='index value 0 wasn not replaced')
def test_eq(self): """Test options._ReList.__eq__.""" test1 = ['foo'] test2 = options._ReList(['foo']) with pytest.raises(TypeError): assert self.test == test1 assert self.test == test2
def test_ne(self): """Test hoptions._ReList.__ne__.""" test1 = ['bar'] test2 = options._ReList(['bar']) with pytest.raises(TypeError): assert self.test != test1 assert self.test != test2
def test_relist_ne(): """options._ReList.__ne__: two ReLists are not equal if their wrapped lists are not equal""" test1 = options._ReList(['foo']) test2 = options._ReList(['bar']) nt.assert_not_equal(test1, test2)
def test_relist_eq(): """options._ReList.__eq__: two ReLists are equal if their wrapped lists are equal""" test1 = options._ReList(['foo']) test2 = options._ReList(['foo']) nt.eq_(test1, test2)
def test_relist_init_iterable(): """options._ReList: handles an iterable argument correctly""" test = options._ReList(['foo']) nt.assert_is_instance(test[0], _RETYPE)
def test_relist_init(): """options._ReList: inializes""" options._ReList()
def setup_class(cls): cls.test = options._ReList(['foo'])
def test_set_other(self): """options._ReListDescriptor.__set__: converts other types to ReList""" val = options._ReList(['foo']) self.test.desc = ['foo'] assert self.test.desc == val
def __init__(self): self.test_desc = options._ReList()
def test_set_other(self): """options._ReListDescriptor.__set__: converts other types to ReList""" val = options._ReList(['foo']) self.test.desc = ['foo'] nt.eq_(self.test.desc, val)
def test_set_relist(self): """options._ReListDescriptor.__set__: assigns an ReList directoy""" val = options._ReList(['foo']) self.test.desc = val nt.ok_(self.test.desc is val, msg='value not assigned directly')
def test_relist_ne_other(): """options._ReList.__ne__: raises TypeError if the other object is not an ReList""" test1 = options._ReList(['foo']) test2 = ['bar'] nt.eq_(test1, test2)
def test_relist_insert(): """options._ReList.len: inserts value as expected""" test = options._ReList(['foo']) obj = re.compile('bar', re.IGNORECASE) test.insert(0, obj) nt.eq_(test[0], obj)
def test_set_relist(self): """options._ReListDescriptor.__set__: assigns an ReList without copying.""" val = options._ReList(['foo']) self.test.desc = val assert self.test.desc is val
def test_ReList_iterable_argument(): """options._ReList: handles an iterable argument correctly""" test = options._ReList(['foo']) assert isinstance(test[0], _RETYPE)
def test_relist_delitem(): """options._ReList.len: removes value as expected""" test = options._ReList(['foo']) del test[0] nt.eq_(len(test), 0)
def setup(self): self.test = options._ReList(['foo'])