Esempio 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')
Esempio 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')
Esempio 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
Esempio 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
Esempio 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)
Esempio 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)
Esempio 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)
Esempio n. 8
0
def test_relist_init():
    """options._ReList: inializes"""
    options._ReList()
Esempio n. 9
0
 def setup_class(cls):
     cls.test = options._ReList(['foo'])
Esempio 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
Esempio n. 11
0
 def __init__(self):
     self.test_desc = options._ReList()
Esempio 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)
Esempio 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')
Esempio n. 14
0
 def __init__(self):
     self.test_desc = options._ReList()
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio n. 20
0
 def setup_class(cls):
     cls.test = options._ReList(['foo'])
Esempio 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)
Esempio 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
Esempio 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)
Esempio n. 24
0
def test_ReList_iterable_argument():
    """options._ReList: handles an iterable argument correctly"""
    test = options._ReList(['foo'])
    assert isinstance(test[0], _RETYPE)
Esempio n. 25
0
def test_relist_init():
    """options._ReList: inializes"""
    options._ReList()
Esempio 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)
Esempio 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)
Esempio n. 28
0
 def setup(self):
     self.test = options._ReList(['foo'])
Esempio 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')