コード例 #1
0
class TestReverseString(object):
	def setup_method(self):
		self.solution = Solution()

	@pytest.mark.parametrize("test_input,expected", [
	    ('test', 'tset'),
	    ('usa', 'asu'),
	    pytest.mark.xfail(('test', 'ajhakldhjf')),
	])
	def test_reverse_string_by_position(self, test_input, expected):
		assert self.solution.reverse_string_by_position(test_input) == expected

	@pytest.mark.parametrize("test_input,expected", [
	    ('test', 'tset'),
	    ('usa', 'asu'),
	])
	def test_reverse_string_recursive(self, test_input, expected):
		assert self.solution.reverse_string_recursive(test_input) == expected

	@pytest.mark.parametrize("test_input,expected", [
	    ('test', 'tset'),
	    ('usa', 'asu'),
	])
	def test_reverse_string_iteratively(self, test_input, expected):
		assert self.solution.reverse_string_iteratively(test_input) == expected

	@pytest.mark.parametrize("test_input,expected", [
	    ('test', 'tset'),
	    ('usa', 'asu'),
	])
	def test_reverse_string_using_built_in_method(self, test_input, expected):
		assert self.solution.reverse_string_using_built_in_method(test_input) == expected
コード例 #2
0
	def setup_method(self):
		self.solution = Solution()