Python tempfile._RandomNameSequence() Examples

The following are 30 code examples of tempfile._RandomNameSequence(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tempfile , or try the search function .
Example #1
Source File: test_tempfile.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_many(self):
        # _RandomNameSequence returns no duplicate strings (stochastic)

        dict = {}
        r = self.r
        for i in xrange(TEST_FILES):
            s = r.next()
            self.nameCheck(s, '', '', '')
            self.assertNotIn(s, dict)
            dict[s] = 1 
Example #2
Source File: test_tempfile.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_supports_iter(self):
        # _RandomNameSequence supports the iterator protocol

        i = 0
        r = self.r
        try:
            for s in r:
                i += 1
                if i == 20:
                    break
        except:
            self.failOnException("iteration") 
Example #3
Source File: test_tempfile.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence) 
Example #4
Source File: test_tempfile.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def setUp(self):
        self.r = tempfile._RandomNameSequence()
        super().setUp() 
Example #5
Source File: test_tempfile.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = next(self.r)
        self.nameCheck(s, '', '', '') 
Example #6
Source File: test_tempfile.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_many(self):
        # _RandomNameSequence returns no duplicate strings (stochastic)

        dict = {}
        r = self.r
        for i in range(TEST_FILES):
            s = next(r)
            self.nameCheck(s, '', '', '')
            self.assertNotIn(s, dict)
            dict[s] = 1 
Example #7
Source File: test_tempfile.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def supports_iter(self):
        # _RandomNameSequence supports the iterator protocol

        i = 0
        r = self.r
        for s in r:
            i += 1
            if i == 20:
                break 
Example #8
Source File: test_tempfile.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence) 
Example #9
Source File: test_tempfile.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def setUp(self):
        self.r = tempfile._RandomNameSequence() 
Example #10
Source File: test_tempfile.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = self.r.next()
        self.nameCheck(s, '', '', '') 
Example #11
Source File: test_tempfile.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test_many(self):
        # _RandomNameSequence returns no duplicate strings (stochastic)

        dict = {}
        r = self.r
        for i in xrange(TEST_FILES):
            s = r.next()
            self.nameCheck(s, '', '', '')
            self.failIf(s in dict)
            dict[s] = 1 
Example #12
Source File: test_tempfile.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test_supports_iter(self):
        # _RandomNameSequence supports the iterator protocol

        i = 0
        r = self.r
        try:
            for s in r:
                i += 1
                if i == 20:
                    break
        except:
            failOnException("iteration") 
Example #13
Source File: test_tempfile.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assert_(isinstance(obj, tempfile._RandomNameSequence)) 
Example #14
Source File: test_tempfile.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def setUp(self):
        self.r = tempfile._RandomNameSequence() 
Example #15
Source File: test_tempfile.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = self.r.next()
        self.nameCheck(s, '', '', '') 
Example #16
Source File: test_tempfile.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_many(self):
        # _RandomNameSequence returns no duplicate strings (stochastic)

        dict = {}
        r = self.r
        for i in xrange(TEST_FILES):
            s = r.next()
            self.nameCheck(s, '', '', '')
            self.assertNotIn(s, dict)
            dict[s] = 1 
Example #17
Source File: test_tempfile.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_supports_iter(self):
        # _RandomNameSequence supports the iterator protocol

        i = 0
        r = self.r
        try:
            for s in r:
                i += 1
                if i == 20:
                    break
        except:
            self.failOnException("iteration") 
Example #18
Source File: test_tempfile.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence) 
Example #19
Source File: test_commands.py    From django-dbbackup with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def _create_file(self, name=None):
        name = name or tempfile._RandomNameSequence().next()
        path = os.path.join(settings.MEDIA_ROOT, name)
        with open(path, 'a+b') as fd:
            fd.write(b'foo') 
Example #20
Source File: test_tempfile.py    From android_universal with MIT License 5 votes vote down vote up
def setUp(self):
        self.r = tempfile._RandomNameSequence()
        super().setUp() 
Example #21
Source File: test_tempfile.py    From android_universal with MIT License 5 votes vote down vote up
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = next(self.r)
        self.nameCheck(s, '', '', '') 
Example #22
Source File: test_tempfile.py    From android_universal with MIT License 5 votes vote down vote up
def test_many(self):
        # _RandomNameSequence returns no duplicate strings (stochastic)

        dict = {}
        r = self.r
        for i in range(TEST_FILES):
            s = next(r)
            self.nameCheck(s, '', '', '')
            self.assertNotIn(s, dict)
            dict[s] = 1 
Example #23
Source File: test_tempfile.py    From android_universal with MIT License 5 votes vote down vote up
def supports_iter(self):
        # _RandomNameSequence supports the iterator protocol

        i = 0
        r = self.r
        for s in r:
            i += 1
            if i == 20:
                break 
Example #24
Source File: test_tempfile.py    From android_universal with MIT License 5 votes vote down vote up
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence) 
Example #25
Source File: test_tempfile.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def setUp(self):
        self.r = tempfile._RandomNameSequence() 
Example #26
Source File: test_tempfile.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = self.r.next()
        self.nameCheck(s, '', '', '') 
Example #27
Source File: test_tempfile.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_many(self):
        # _RandomNameSequence returns no duplicate strings (stochastic)

        dict = {}
        r = self.r
        for i in xrange(TEST_FILES):
            s = r.next()
            self.nameCheck(s, '', '', '')
            self.assertNotIn(s, dict)
            dict[s] = 1 
Example #28
Source File: test_tempfile.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_supports_iter(self):
        # _RandomNameSequence supports the iterator protocol

        i = 0
        r = self.r
        try:
            for s in r:
                i += 1
                if i == 20:
                    break
        except:
            self.failOnException("iteration") 
Example #29
Source File: test_tempfile.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence) 
Example #30
Source File: test_tempfile.py    From oss-ftp with MIT License 5 votes vote down vote up
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence)