コード例 #1
0
ファイル: test_random_string.py プロジェクト: alexguev/heat
    def test_generate_random_string(self):
        # run each test multiple times to confirm random generator
        # doesn't generate a matching pattern by chance
        for i in range(1, 32):
            sequence = RandomString._sequences[self.seq]
            r = RandomString._generate_random_string(sequence, self.length)

            self.assertThat(r, HasLength(self.length))
            regex = '%s{%s}' % (self.pattern, self.length)
            self.assertThat(r, MatchesRegex(regex))
コード例 #2
0
ファイル: test_random_string.py プロジェクト: zzz6519003/heat
    def test_generate_random_string(self):
        # run each test multiple times to confirm random generator
        # doesn't generate a matching pattern by chance
        for i in range(1, 32):
            sequence = RandomString._sequences[self.seq]
            r = RandomString._generate_random_string(sequence, self.length)

            self.assertThat(r, HasLength(self.length))
            regex = '%s{%s}' % (self.pattern, self.length)
            self.assertThat(r, MatchesRegex(regex))