Exemple #1
0
 def test_string_with_one_digit_number_increments_properly(self):
     self.assertEqual(increment_string('bar1'), 'bar2')
     self.assertEqual(increment_string('foobar3'), 'foobar4')
Exemple #2
0
 def test_long_numbers_without_letters(self):
     self.assertEqual(increment_string('8846662'), '8846663')
Exemple #3
0
 def test_string_without_numbers_add_one(self):
     self.assertEqual(increment_string('foo'), 'foo1')
Exemple #4
0
 def test_works_empty_strings(self):
     self.assertEqual(increment_string(''), '1')
Exemple #5
0
 def test_one_digit_number(self):
     self.assertEqual(increment_string('1'), '2')
Exemple #6
0
 def test_string_ending_with_multiple_zeroes(self):
     self.assertEqual(increment_string('hell0 world00'), 'hell0 world01')
     self.assertEqual(increment_string('hell0 world000'), 'hell0 world001')
Exemple #7
0
 def test_numbers_beginning_with_zeroes(self):
     self.assertEqual(increment_string('hell0 world01'), 'hell0 world02')
     self.assertEqual(increment_string('hell0 world099'), 'hell0 world100')
     self.assertEqual(increment_string('hell0 world09'), 'hell0 world10')
Exemple #8
0
 def test_numbers_in_middle_do_not_confuse_function(self):
     self.assertEqual(increment_string('hell0 world999'), 'hell0 world1000')
Exemple #9
0
 def test_string_with_three_digit_number_increments_properly(self):
     self.assertEqual(increment_string('hello world123'), 'hello world124')
     self.assertEqual(increment_string('hello world999'), 'hello world1000')
Exemple #10
0
 def test_string_with_two_digit_number_increments_properly(self):
     self.assertEqual(increment_string('hello world12'), 'hello world13')
     self.assertEqual(increment_string('hello world19'), 'hello world20')