Ejemplo n.º 1
0
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')
Ejemplo n.º 2
0
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')
Ejemplo n.º 3
0
    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
Ejemplo n.º 4
0
    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
Ejemplo n.º 5
0
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)
Ejemplo n.º 6
0
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)
Ejemplo n.º 7
0
def test_relist_init_iterable():
    """options._ReList: handles an iterable argument correctly"""
    test = options._ReList(['foo'])
    nt.assert_is_instance(test[0], _RETYPE)
Ejemplo n.º 8
0
def test_relist_init():
    """options._ReList: inializes"""
    options._ReList()
Ejemplo n.º 9
0
 def setup_class(cls):
     cls.test = options._ReList(['foo'])
Ejemplo n.º 10
0
 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
Ejemplo n.º 11
0
 def __init__(self):
     self.test_desc = options._ReList()
Ejemplo n.º 12
0
 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)
Ejemplo n.º 13
0
 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')
Ejemplo n.º 14
0
 def __init__(self):
     self.test_desc = options._ReList()
Ejemplo n.º 15
0
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)
Ejemplo n.º 16
0
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)
Ejemplo n.º 17
0
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)
Ejemplo n.º 18
0
def test_relist_init_iterable():
    """options._ReList: handles an iterable argument correctly"""
    test = options._ReList(['foo'])
    nt.assert_is_instance(test[0], _RETYPE)
Ejemplo n.º 19
0
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)
Ejemplo n.º 20
0
 def setup_class(cls):
     cls.test = options._ReList(['foo'])
Ejemplo n.º 21
0
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)
Ejemplo n.º 22
0
 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
Ejemplo n.º 23
0
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)
Ejemplo n.º 24
0
def test_ReList_iterable_argument():
    """options._ReList: handles an iterable argument correctly"""
    test = options._ReList(['foo'])
    assert isinstance(test[0], _RETYPE)
Ejemplo n.º 25
0
def test_relist_init():
    """options._ReList: inializes"""
    options._ReList()
Ejemplo n.º 26
0
def test_relist_delitem():
    """options._ReList.len: removes value as expected"""
    test = options._ReList(['foo'])
    del test[0]
    nt.eq_(len(test), 0)
Ejemplo n.º 27
0
def test_relist_delitem():
    """options._ReList.len: removes value as expected"""
    test = options._ReList(['foo'])
    del test[0]
    nt.eq_(len(test), 0)
Ejemplo n.º 28
0
 def setup(self):
     self.test = options._ReList(['foo'])
Ejemplo n.º 29
0
 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')