Пример #1
0
 def test_first_index_in_set(self):
     """first_index_in_set should return index of first occurrence """
     vowels = 'aeiou'
     s1 = 'ebcua'
     s2 = 'bcbae'
     s3 = ''
     s4 = 'cbd'
     self.assertEqual(first_index_in_set(s1, vowels), 0)
     self.assertEqual(first_index_in_set(s2, vowels), 3)
     self.assertEqual(first_index_in_set(s3, vowels), None)
     self.assertEqual(first_index_in_set(s4, vowels), None)
Пример #2
0
 def test_first_index_in_set(self):
     """first_index_in_set should return index of first occurrence """
     vowels = 'aeiou'
     s1 = 'ebcua'
     s2 = 'bcbae'
     s3 = ''
     s4 = 'cbd'
     self.assertEqual(first_index_in_set(s1, vowels), 0)
     self.assertEqual(first_index_in_set(s2, vowels), 3)
     self.assertEqual(first_index_in_set(s3, vowels), None)
     self.assertEqual(first_index_in_set(s4, vowels), None)
Пример #3
0
 def test_first_index_in_set(self):
     """first_index_in_set should return index of first occurrence """
     vowels = "aeiou"
     s1 = "ebcua"
     s2 = "bcbae"
     s3 = ""
     s4 = "cbd"
     self.assertEqual(first_index_in_set(s1, vowels), 0)
     self.assertEqual(first_index_in_set(s2, vowels), 3)
     self.assertEqual(first_index_in_set(s3, vowels), None)
     self.assertEqual(first_index_in_set(s4, vowels), None)
Пример #4
0
 def firstNotInAlphabet(self, sequence, alphabet=None):
     """Returns index of first item not in alphabet, or None.
     
     Defaults to self.Alphabet if alphabet not supplied.
     """
     if alphabet is None:
         alphabet = self.Alphabet
     return first_index_in_set(sequence, alphabet)
Пример #5
0
 def firstNotInAlphabet(self, sequence, alphabet=None):
     """Returns index of first item not in alphabet, or None.
     
     Defaults to self.Alphabet if alphabet not supplied.
     """
     if alphabet is None:
         alphabet = self.Alphabet
     return first_index_in_set(sequence, alphabet)
Пример #6
0
 def isValidOnAlphabet(self, sequence, alphabet=None):
     """Returns True if sequence contains only items in alphabet.
     
     Alphabet can actually be anything that implements __contains__.
     Defaults to self.Alphabet if not supplied.
     """
     if alphabet is None:
         alphabet = self.Alphabet
     return first_index_in_set(sequence, alphabet) is not None
Пример #7
0
 def isValidOnAlphabet(self, sequence, alphabet=None):
     """Returns True if sequence contains only items in alphabet.
     
     Alphabet can actually be anything that implements __contains__.
     Defaults to self.Alphabet if not supplied.
     """
     if alphabet is None:
         alphabet = self.Alphabet
     return first_index_in_set(sequence, alphabet) is not None