Esempio n. 1
0
    def testMul(self):
        """Test __mul__"""
        assert (self.plain1 * 7) == (self.proxied1 * 7)
        assert isProxy(self.proxied1 * 9)

        for p in self.proxied1:
            assert isProxy(p)
Esempio n. 2
0
    def testMul(self):
        """Test __mul__"""
        self.assertEqual((self.plain1 * 7), (self.proxied1 * 7))
        self.assertTrue(isProxy(self.proxied1 * 9))

        for p in self.proxied1:
            self.assertTrue(isProxy(p))
Esempio n. 3
0
    def testMul(self):
        """Test __mul__"""
        assert len(self.plain1 * 7) == len(self.proxied1 * 7)
        assert isProxy(self.proxied1 * 9)

        for p in self.proxied1:
            assert isProxy(p)
Esempio n. 4
0
    def testMul(self):
        """Test __mul__"""
        self.assertEqual((self.plain1 * 7), (self.proxied1 * 7))
        self.assertTrue(isProxy(self.proxied1 * 9))

        for p in self.proxied1:
            self.assertTrue(isProxy(p))
Esempio n. 5
0
    def testGet(self):

        assert isProxy(self.test_job.application.seq)
        assert isProxy(self.test_job.application.gList)
        assert isProxy(self.test_job.application.gListComp)

        assert isType(self.test_job.application.seq, gangaList)
        assert isType(self.test_job.application.gList, gangaList)
        assert isType(self.test_job.application.gListComp, gangaList)
    def testGet(self):

        assert isProxy(self.test_job.application.seq)
        assert isProxy(self.test_job.application.gList)
        assert isProxy(self.test_job.application.gListComp)

        assert isType(self.test_job.application.seq, gangaList)
        assert isType(self.test_job.application.gList, gangaList)
        assert isType(self.test_job.application.gListComp, gangaList)
    def testApp(self):

        assert not isinstance(self.test_job.application.seq, list)

        for f in self.test_job.application.gListComp:
            assert isProxy(f), 'Items in list must be proxies'

        for s in self.test_job.application.gList:
            assert not isProxy(s), 'Items in list must not be proxies'
Esempio n. 8
0
    def testApp(self):

        assert not isinstance(self.test_job.application.seq, list)

        for f in self.test_job.application.gListComp:
            assert isProxy(f), 'Items in list must be proxies'

        for s in self.test_job.application.gList:
            assert not isProxy(s), 'Items in list must not be proxies'
Esempio n. 9
0
    def testIAdd(self):
        """Test __iadd__"""
        self.assertTrue(isProxy(self.proxied1), 'Must be Proxy')
        self.assertTrue(isProxy(self.proxied2), 'Must be Proxy')

        self.plain1 += self.plain2
        self.proxied1 += self.proxied2

        self.assertEqual(self.plain1, self.proxied1, 'Addition should be the same')
        self.assertTrue(isProxy(self.proxied1), 'Proxy must be added')
Esempio n. 10
0
    def testIAdd(self):
        """Test __iadd__"""
        self.assertTrue(isProxy(self.proxied1), 'Must be Proxy')
        self.assertTrue(isProxy(self.proxied2), 'Must be Proxy')

        self.plain1 += self.plain2
        self.proxied1 += self.proxied2

        self.assertEqual(self.plain1, self.proxied1, 'Addition should be the same')
        self.assertTrue(isProxy(self.proxied1), 'Proxy must be added')
Esempio n. 11
0
    def testIAdd(self):
        """Test __iadd__"""
        assert isProxy(self.proxied1), 'Must be Proxy'
        assert isProxy(self.proxied2), 'Must be Proxy'

        self.plain1 += self.plain2
        self.proxied1 += self.proxied2

        assert self.plain1 == self.proxied1, 'Addition should be the same'
        assert isProxy(self.proxied1), 'Proxy must be added'
Esempio n. 12
0
    def testApp(self):

        from Ganga.GPIDev.Base.Proxy import isProxy
        assert not isinstance(self.test_job.application.seq, list)

        for f in self.test_job.application.gListComp:
            assert isProxy(f), 'Items in list must be proxies'

        for s in self.test_job.application.gList:
            assert not isProxy(s), 'Items in list must not be proxies'
Esempio n. 13
0
    def testIAdd(self):
        """Test __iadd__"""
        assert isProxy(self.proxied1), 'Must be Proxy'
        assert isProxy(self.proxied2), 'Must be Proxy'

        self.plain1 += self.plain2
        self.proxied1 += self.proxied2

        assert self.plain1 == self.proxied1, 'Addition should be the same'
        assert isProxy(self.proxied1), 'Proxy must be added'
Esempio n. 14
0
    def testApp(self):

        from Ganga.GPIDev.Base.Proxy import isProxy
        assert not isinstance(self.test_job.application.seq, list)

        for f in self.test_job.application.gListComp:
            assert isProxy(f), 'Items in list must be proxies'

        for s in self.test_job.application.gList:
            assert not isProxy(s), 'Items in list must not be proxies'
Esempio n. 15
0
    def testGet(self):
        from Ganga.GPIDev.Lib.GangaList.GangaList import GangaList as gangaList
        from Ganga.GPIDev.Base.Proxy import isProxy, isType

        assert isProxy(self.test_job.application.seq)
        assert isProxy(self.test_job.application.gList)
        assert isProxy(self.test_job.application.gListComp)

        assert isType(self.test_job.application.seq, gangaList)
        assert isType(self.test_job.application.gList, gangaList)
        assert isType(self.test_job.application.gListComp, gangaList)
Esempio n. 16
0
    def testGetDefaults(self):

        test_job = Job(application=GListApp(), backend=TestSubmitter())

        assert isProxy(test_job.application.seq)
        assert isProxy(test_job.application.gList)
        assert isProxy(test_job.application.gListComp)

        assert isType(test_job.application.seq, gangaList)
        assert isType(test_job.application.gList, gangaList)
        assert isType(test_job.application.gListComp, gangaList)
    def testGetDefaults(self):

        test_job = Job(application=GListApp(), backend=TestSubmitter())

        assert isProxy(test_job.application.seq)
        assert isProxy(test_job.application.gList)
        assert isProxy(test_job.application.gListComp)

        assert isType(test_job.application.seq, gangaList)
        assert isType(test_job.application.gList, gangaList)
        assert isType(test_job.application.gListComp, gangaList)
Esempio n. 18
0
    def testGet(self):
        from Ganga.GPIDev.Lib.GangaList.GangaList import GangaList as gangaList
        from Ganga.GPIDev.Base.Proxy import isProxy, isType

        assert isProxy(self.test_job.application.seq)
        assert isProxy(self.test_job.application.gList)
        assert isProxy(self.test_job.application.gListComp)

        assert isType(self.test_job.application.seq, gangaList)
        assert isType(self.test_job.application.gList, gangaList)
        assert isType(self.test_job.application.gListComp, gangaList)
Esempio n. 19
0
    def testAddMixed2(self):

        self.plain1 = range(10)
        self.plain2 = range(10)

        self.assertTrue(isProxy(self.proxied2[-1]), 'Element access must get proxies')
        self.assertFalse(isProxy(self.plain1[0]), 'Element access must not proxies')
        self.assertTrue(isProxy((self.plain1 + self.proxied2)[-1]), 'File objects should remain proxies')
        self.assertFalse(isProxy((self.plain1 + self.proxied2)[0]), 'Objects in plain lists should be left alone')

        self.assertEqual((self.plain1 + self.proxied2)[-1], self.proxied2[-1], 'File objects should be equal')
        self.assertIs((self.plain1 + self.proxied2)[-1], self.proxied2[-1], 'File objects should be identical')
Esempio n. 20
0
    def testAddMixed2(self):

        self.plain1 = range(10)
        self.plain2 = range(10)

        assert isProxy(self.proxied2[-1]), 'Element access must get proxies'
        assert not isProxy(self.plain1[0]), 'Element access must not proxies'
        assert isProxy((self.plain1 + self.proxied2)[-1]), 'File objects should remain proxies'
        assert not isProxy((self.plain1 + self.proxied2)[0]), 'Objects in plain lists should be left alone'

        assert (self.plain1 + self.proxied2)[-1] == self.proxied2[-1], 'File objects should be equal'
        assert (self.plain1 + self.proxied2)[-1] is self.proxied2[-1], 'File objects should be identical'
Esempio n. 21
0
    def testAddMixed2(self):

        self.plain1 = range(10)
        self.plain2 = range(10)

        self.assertTrue(isProxy(self.proxied2[-1]), 'Element access must get proxies')
        self.assertFalse(isProxy(self.plain1[0]), 'Element access must not proxies')
        self.assertTrue(isProxy((self.plain1 + self.proxied2)[-1]), 'File objects should remain proxies')
        self.assertFalse(isProxy((self.plain1 + self.proxied2)[0]), 'Objects in plain lists should be left alone')

        self.assertEqual((self.plain1 + self.proxied2)[-1], self.proxied2[-1], 'File objects should be equal')
        self.assertIs((self.plain1 + self.proxied2)[-1], self.proxied2[-1], 'File objects should be identical')
Esempio n. 22
0
    def testIAddSlice(self):
        """Test __iadd__ on slices"""

        s1 = self.plain1[3:7]
        s1 += self.plain2[2:5]

        s2 = self.proxied1[3:7]
        s2 += self.proxied2[2:5]

        self.assertEqual(s1, s2, 'Addition should be the same')

        self.assertFalse(isProxy(s1), 'Proxy Not Needed')
        self.assertTrue(isProxy(s2), 'Proxy Needed')
Esempio n. 23
0
    def testIAddSlice(self):
        """Test __iadd__ on slices"""

        s1 = self.plain1[3:7]
        s1 += self.plain2[2:5]

        s2 = self.proxied1[3:7]
        s2 += self.proxied2[2:5]

        assert s1 == s2, 'Addition should be the same'

        assert not isProxy(s1), 'Proxy Not Needed'
        assert isProxy(s2), 'Proxy Needed'
Esempio n. 24
0
    def testIAddSlice(self):
        """Test __iadd__ on slices"""

        s1 = self.plain1[3:7]
        s1 += self.plain2[2:5]

        s2 = self.proxied1[3:7]
        s2 += self.proxied2[2:5]

        assert s1 == s2, 'Addition should be the same'

        assert not isProxy(s1), 'Proxy Not Needed'
        assert isProxy(s2), 'Proxy Needed'
Esempio n. 25
0
    def testIAddSlice(self):
        """Test __iadd__ on slices"""

        s1 = self.plain1[3:7]
        s1 += self.plain2[2:5]

        s2 = self.proxied1[3:7]
        s2 += self.proxied2[2:5]

        self.assertEqual(s1, s2, 'Addition should be the same')

        self.assertFalse(isProxy(s1), 'Proxy Not Needed')
        self.assertTrue(isProxy(s2), 'Proxy Needed')
Esempio n. 26
0
    def testGetDefaults(self):

        from Ganga.GPI import Job, TestSubmitter, GListApp
        from Ganga.GPIDev.Lib.GangaList.GangaList import GangaList as gangaList
        from Ganga.GPIDev.Base.Proxy import isProxy, isType

        test_job = Job(application=GListApp(), backend=TestSubmitter())

        assert isProxy(test_job.application.seq)
        assert isProxy(test_job.application.gList)
        assert isProxy(test_job.application.gListComp)

        assert isType(test_job.application.seq, gangaList)
        assert isType(test_job.application.gList, gangaList)
        assert isType(test_job.application.gListComp, gangaList)
Esempio n. 27
0
    def testGetDefaults(self):

        from Ganga.GPI import Job, TestSubmitter, GListApp
        from Ganga.GPIDev.Lib.GangaList.GangaList import GangaList as gangaList
        from Ganga.GPIDev.Base.Proxy import isProxy, isType

        test_job = Job(application=GListApp(), backend=TestSubmitter())

        assert isProxy(test_job.application.seq)
        assert isProxy(test_job.application.gList)
        assert isProxy(test_job.application.gListComp)

        assert isType(test_job.application.seq, gangaList)
        assert isType(test_job.application.gList, gangaList)
        assert isType(test_job.application.gListComp, gangaList)
Esempio n. 28
0
 def has_proxy_element(_list):
     """
     Returns if a proxy object has crept into the list
     Args:
         _list (list): Any iterable object
     """
     return all([isProxy(l) for l in _list])
Esempio n. 29
0
 def has_proxy_element(_list):
     """
     Returns if a proxy object has crept into the list
     Args:
         _list (list): Any iterable object
     """
     return all([isProxy(l) for l in _list])
Esempio n. 30
0
    def testIMul(self):
        """Test __imul__"""

        self.plain1 *= 5
        self.proxied1 *= 5

        self.assertEqual(self.plain1, self.proxied1, 'Multiplication should be the same')
        self.assertTrue(isProxy(self.proxied1), 'Proxy must be added')
Esempio n. 31
0
    def testIMul(self):
        """Test __imul__"""

        self.plain1 *= 5
        self.proxied1 *= 5

        self.assertEqual(self.plain1, self.proxied1, 'Multiplication should be the same')
        self.assertTrue(isProxy(self.proxied1), 'Proxy must be added')
    def testSetSimple(self):
        """Sets a list of proxies and makes sure we get a GangaList"""

        # simple types
        s = [self._makeRandomString() for _ in range(15)]
        assert isinstance(s, list), 'Nothing funny going on here'
        for ss in s:
            assert not isProxy(ss), 'We have no proxies'
        self.test_job.application.gList = s

        assert len(self.test_job.application.gList) == len(
            s), 'List must have the correct length.'
        assert self.test_job.application.gList == s, 'lists should be the same'

        for ss in self.test_job.application.gList:
            assert not isProxy(ss), 'We have no proxies'
        assert isinstance(self.test_job.application.gList._impl, gangaList)
Esempio n. 33
0
    def testSetSimple(self):
        """Sets a list of proxies and makes sure we get a GangaList"""

        # simple types
        s = [self._makeRandomString() for _ in range(15)]
        assert isinstance(s, list), 'Nothing funny going on here'
        for ss in s:
            assert not isProxy(ss), 'We have no proxies'
        self.test_job.application.gList = s

        assert len(self.test_job.application.gList) == len(
            s), 'List must have the correct length.'
        assert self.test_job.application.gList == s, 'lists should be the same'

        for ss in self.test_job.application.gList:
            assert not isProxy(ss), 'We have no proxies'
        assert isinstance(self.test_job.application.gList._impl, gangaList)
Esempio n. 34
0
    def testIMul(self):
        """Test __imul__"""

        self.plain1 *= 5
        self.proxied1 *= 5

        assert self.plain1 == self.proxied1, 'Multiplication should be the same'
        assert isProxy(self.proxied1), 'Proxy must be added'
Esempio n. 35
0
    def testIMul(self):
        """Test __imul__"""

        self.plain1 *= 5
        self.proxied1 *= 5

        assert self.plain1 == self.proxied1, 'Multiplication should be the same'
        assert isProxy(self.proxied1), 'Proxy must be added'
Esempio n. 36
0
    def testContains(self):
        """Tests __contains__"""

        plist = [addProxy(x) for x in self.plain1]
        self.assertEqual(plist, self.proxied1)

        for p in plist:
            self.assertTrue(isProxy(p))
            self.assertIn(p, self.proxied1, 'Proxied list should contain each proxied object')
    def testSetComponent(self):
        """Sets a list of proxies and makes sure we get a GangaList"""

        # component types
        r = [self._makeRandomTFile() for _ in range(15)]
        assert isinstance(r, list), 'nothing funny going on'
        for rp in r:
            assert isProxy(rp), 'We have proxies'

        self.test_job.application.gListComp = r

        assert len(self.test_job.application.gListComp) == len(
            r), 'List must have the correct length.'
        assert self.test_job.application.gListComp == r, 'lists should be the same'

        for rp in self.test_job.application.gListComp:
            assert isProxy(rp), 'We have proxies'
        assert isinstance(self.test_job.application.gListComp._impl, gangaList)
Esempio n. 38
0
    def testSetComponent(self):
        """Sets a list of proxies and makes sure we get a GangaList"""

        # component types
        r = [self._makeRandomTFile() for _ in range(15)]
        assert isinstance(r, list), 'nothing funny going on'
        for rp in r:
            assert isProxy(rp), 'We have proxies'

        self.test_job.application.gListComp = r

        assert len(self.test_job.application.gListComp) == len(
            r), 'List must have the correct length.'
        assert self.test_job.application.gListComp == r, 'lists should be the same'

        for rp in self.test_job.application.gListComp:
            assert isProxy(rp), 'We have proxies'
        assert isinstance(self.test_job.application.gListComp._impl, gangaList)
Esempio n. 39
0
    def testAddMixed(self):
        """Test __add__ with mixed lists and GangaLists"""
        self.assertEqual((self.plain1 + self.plain2), (self.proxied1 + self.plain2))
        self.assertEqual((self.plain2 + self.plain1), (self.plain2 + self.proxied1))
        self.assertTrue(isProxy(self.proxied1 + self.plain2))

        self.assertEqual((self.plain2 + self.plain1), (self.plain2 + self.proxied1))
        self.assertEqual((self.plain1 + self.plain2), (self.plain1 + self.proxied2))
        self.assertTrue(isinstance(self.plain1 + self.proxied2, list))
Esempio n. 40
0
    def testAddMixed(self):
        """Test __add__ with mixed lists and GangaLists"""
        assert (self.plain1 + self.plain2) == (self.proxied1 + self.plain2)
        assert (self.plain2 + self.plain1) == (self.plain2 + self.proxied1)
        assert isProxy(self.proxied1 + self.plain2)

        assert (self.plain2 + self.plain1) == (self.plain2 + self.proxied1)
        assert (self.plain1 + self.plain2) == (self.plain1 + self.proxied2)
        assert isinstance(self.plain1 + self.proxied2, list)
Esempio n. 41
0
    def testContains(self):
        """Tests __contains__"""

        plist = [addProxy(x) for x in self.plain1]
        self.assertEqual(plist, self.proxied1)

        for p in plist:
            self.assertTrue(isProxy(p))
            self.assertIn(p, self.proxied1, 'Proxied list should contain each proxied object')
Esempio n. 42
0
    def testReversed(self):
        """Test the __reversed__ feature (new in python 2.4)."""

        count = len(self.proxied1) - 1
        for i in self.proxied1.__reversed__():
            self.assertIs(i, self.proxied1[count])
            self.assertTrue(isProxy(i))
            self.assertTrue(isType(i, TFile))
            count -= 1
Esempio n. 43
0
    def testReversed(self):
        """Test the __reversed__ feature (new in python 2.4)."""

        count = len(self.proxied1) - 1
        for i in self.proxied1.__reversed__():
            self.assertIs(i, self.proxied1[count])
            self.assertTrue(isProxy(i))
            self.assertTrue(isType(i, TFile))
            count -= 1
Esempio n. 44
0
    def testIter(self):

        count = 0
        for f in self.proxied1:
            count += 1
            self.assertTrue(isProxy(f))
            self.assertTrue(isType(f, TFile))

        self.assertEqual(count, len(self.proxied1), 'Must visit every member')
Esempio n. 45
0
    def testIAddMixed(self):
        """Test __iadd__ where we mix lists and GangaLists"""
        assert isProxy(self.proxied1), 'Must be Proxy'
        assert isProxy(self.proxied2), 'Must be Proxy'

        self.plain1 += self.plain2
        self.proxied1 += self.plain2

        assert self.plain1 == self.proxied1, 'Addition should be the same'
        assert isProxy(self.proxied1), 'Proxy must be added'
        assert isinstance(self.plain1, list), 'Must be list instance'

        self.plain2 += self.proxied1
        self.proxied2 += self.proxied1

        assert self.plain2 == self.proxied2, 'Addition should be the same'
        assert isProxy(self.proxied2), 'Proxy must be added'
        assert isinstance(self.plain2, list), 'Must be list instance'
Esempio n. 46
0
    def testContains(self):
        """Tests __contains__"""

        plist = [addProxy(x) for x in self.plain1]
        assert plist == self.proxied1

        for p in plist:
            assert isProxy(p)
            assert p in self.proxied1, 'Proxied list should contain each proxied object'
Esempio n. 47
0
    def testContains(self):
        """Tests __contains__"""

        plist = [addProxy(x) for x in self.plain1]
        assert plist == self.proxied1

        for p in plist:
            assert isProxy(p)
            assert p in self.proxied1, 'Proxied list should contain each proxied object'
Esempio n. 48
0
    def testIAddMixed(self):
        """Test __iadd__ where we mix lists and GangaLists"""
        self.assertTrue(isProxy(self.proxied1), 'Must be Proxy')
        self.assertTrue(isProxy(self.proxied2), 'Must be Proxy')

        self.plain1 += self.plain2
        self.proxied1 += self.plain2

        self.assertEqual(self.plain1, self.proxied1, 'Addition should be the same')
        self.assertTrue(isProxy(self.proxied1), 'Proxy must be added')
        self.assertTrue(isinstance(self.plain1, list), 'Must be list instance')

        self.plain2 += self.proxied1
        self.proxied2 += self.proxied1

        self.assertEqual(self.plain2, self.proxied2, 'Addition should be the same')
        self.assertTrue(isProxy(self.proxied2), 'Proxy must be added')
        self.assertTrue(isinstance(self.plain2, list), 'Must be list instance')
Esempio n. 49
0
    def testIAddMixed(self):
        """Test __iadd__ where we mix lists and GangaLists"""
        self.assertTrue(isProxy(self.proxied1), 'Must be Proxy')
        self.assertTrue(isProxy(self.proxied2), 'Must be Proxy')

        self.plain1 += self.plain2
        self.proxied1 += self.plain2

        self.assertEqual(self.plain1, self.proxied1, 'Addition should be the same')
        self.assertTrue(isProxy(self.proxied1), 'Proxy must be added')
        self.assertTrue(isinstance(self.plain1, list), 'Must be list instance')

        self.plain2 += self.proxied1
        self.proxied2 += self.proxied1

        self.assertEqual(self.plain2, self.proxied2, 'Addition should be the same')
        self.assertTrue(isProxy(self.proxied2), 'Proxy must be added')
        self.assertTrue(isinstance(self.plain2, list), 'Must be list instance')
Esempio n. 50
0
    def testAddMixed2(self):

        self.plain1 = range(10)
        self.plain2 = range(10)

        assert isProxy(self.proxied2[-1]), 'Element access must get proxies'
        assert not isProxy(self.plain1[0]), 'Element access must not proxies'
        assert isProxy(
            (self.plain1 +
             self.proxied2)[-1]), 'File objects should remain proxies'
        assert not isProxy(
            (self.plain1 +
             self.proxied2)[0]), 'Objects in plain lists should be left alone'

        assert (self.plain1 + self.proxied2
                )[-1] == self.proxied2[-1], 'File objects should be equal'
        assert (self.plain1 + self.proxied2
                )[-1] is self.proxied2[-1], 'File objects should be identical'
Esempio n. 51
0
    def testIter(self):

        count = 0
        for f in self.proxied1:
            count += 1
            self.assertTrue(isProxy(f))
            self.assertTrue(isType(f, TFile))

        self.assertEqual(count, len(self.proxied1), 'Must visit every member')
Esempio n. 52
0
    def testAddMixed(self):
        """Test __add__ with mixed lists and GangaLists"""
        self.assertEqual((self.plain1 + self.plain2), (self.proxied1 + self.plain2))
        self.assertEqual((self.plain2 + self.plain1), (self.plain2 + self.proxied1))
        self.assertTrue(isProxy(self.proxied1 + self.plain2))

        self.assertEqual((self.plain2 + self.plain1), (self.plain2 + self.proxied1))
        self.assertEqual((self.plain1 + self.plain2), (self.plain1 + self.proxied2))
        self.assertTrue(isinstance(self.plain1 + self.proxied2, list))
Esempio n. 53
0
    def testIAddMixed(self):
        """Test __iadd__ where we mix lists and GangaLists"""
        assert isProxy(self.proxied1), 'Must be Proxy'
        assert isProxy(self.proxied2), 'Must be Proxy'

        self.plain1 += self.plain2
        self.proxied1 += self.plain2

        assert self.plain1 == self.proxied1, 'Addition should be the same'
        assert isProxy(self.proxied1), 'Proxy must be added'
        assert isinstance(self.plain1, list), 'Must be list instance'

        self.plain2 += self.proxied1
        self.proxied2 += self.proxied1

        assert self.plain2 == self.proxied2, 'Addition should be the same'
        assert isProxy(self.proxied2), 'Proxy must be added'
        assert isinstance(self.plain2, list), 'Must be list instance'
Esempio n. 54
0
    def testReversed(self):
        """Test the __reversed__ feature (new in python 2.4)."""

        from TFile import TFile as tF
        count = len(self.proxied1) - 1
        for i in self.proxied1.__reversed__():
            assert i is self.proxied1[count]
            assert isProxy(i)
            assert isType(i, tF)
            count -= 1
Esempio n. 55
0
    def testReversed(self):
        """Test the __reversed__ feature (new in python 2.4)."""

        from TFile import TFile as tF
        count = len(self.proxied1) - 1
        for i in self.proxied1.__reversed__():
            assert i is self.proxied1[count]
            assert isProxy(i)
            assert isType(i, tF)
            count -= 1
Esempio n. 56
0
    def testIter(self):

        from TFile import TFile as tF

        count = 0
        for f in self.proxied1:
            count += 1
            assert isProxy(f)
            assert isType(f, tF)

        assert count == len(self.proxied1), 'Must visit every member'
Esempio n. 57
0
    def testSetItem(self):
        """Test __setitem__"""

        t = TFile(name='foo', subdir='cheese')
        test_index = 7
        self.plain1[test_index] = t
        assert self.plain1[test_index] is t

        self.proxied1[test_index] = t
        assert self.proxied1[test_index] is t
        assert isProxy(self.proxied1[test_index])
Esempio n. 58
0
    def testSetItem(self):
        """Test __setitem__"""

        t = TFile(name='foo', subdir='cheese')
        test_index = 7
        self.plain1[test_index] = t
        assert self.plain1[test_index] is t

        self.proxied1[test_index] = t
        assert self.proxied1[test_index] is t
        assert isProxy(self.proxied1[test_index])
Esempio n. 59
0
    def testIter(self):

        from TFile import TFile as tF

        count = 0
        for f in self.proxied1:
            count += 1
            assert isProxy(f)
            assert isType(f, tF)

        assert count == len(self.proxied1), 'Must visit every member'
Esempio n. 60
0
    def testSetItem(self):
        """Test __setitem__"""

        t = TFile(name='foo', subdir='cheese')
        test_index = 7
        self.plain1[test_index] = t
        self.assertIs(self.plain1[test_index], t)

        self.proxied1[test_index] = t
        self.assertIs(self.proxied1[test_index], t)
        self.assertTrue(isProxy(self.proxied1[test_index]))