Ejemplo n.º 1
0
    def test_cat2(self):
        self.assertEqual("There are no arguments.", cat2([]))

        expected_string1 = "Some content 1.\nSome content 2."
        self.assertEqual(expected_string1, cat2(['cat2', 'test_file1', 'test_file2']))

        expected_string2 = self.content1 + "\n" + self.content2
        self.assertEqual(expected_string2, cat2(['cat2', 'file1.txt', 'file2.txt']))
Ejemplo n.º 2
0
	def test_with_two_files(self):
		self.first_file.write("Python is awesome!")
		self.first_file.close()
		self.second_file.write("You are right, baby!")
		self.second_file.close()
		expected_result="Python is awesome!\n\nYou are right, baby!"
		self.assertEqual(expected_result,cat2([self.first_file_name,self.second_file_name]))
Ejemplo n.º 3
0
	def test_with_three_files(self):
		self.first_file.write("This")
		self.first_file.close()
		self.second_file.write("That")
		self.second_file.close()
		self.third_file.write("Those")
		self.third_file.close()
		expected_result="This\n\nThat\n\nThose"
		self.assertEqual(expected_result,cat2([self.first_file_name,self.second_file_name,self.third_file_name]))
Ejemplo n.º 4
0
 def test_with_two_files(self):
     sys.argv.append("file.txt")
     sys.argv.append("file2.txt")
     for index in range(1, len(sys.argv)):
         file_to_read = sys.argv[index]
         file_text = open(file_to_read, "r")
         content = file_text.read() + "\n"
         file_text.close()
         self.assertEqual(content, solution.cat2(file_to_read))
Ejemplo n.º 5
0
 def test_with_two_files(self):
     self.first_file.write("Python is awesome!")
     self.first_file.close()
     self.second_file.write(
         "Also, you can use Python at a lot of different places!")
     self.second_file.close()
     result = "Python is awesome!\n\nAlso, you can use Python at a lot of different places!"
     self.assertEqual(result,
                      cat2([self.first_file_name, self.second_file_name]))
Ejemplo n.º 6
0
 def test_with_three_files(self):
     self.assertEqual(solution.cat2(*self.filenames),
                      '\n'.join([self.text1, self.text2, self.text3]))
Ejemplo n.º 7
0
 def test_with_a_single_file(self):
     self.assertEqual(solution.cat2('test_text_file1.txt'), self.text1)
 def test_cat2(self):
     filenames = [self.filename1, self.filename2, self.filename3]
     self.assertEqual("Hello, I am a test file\n\n\n\nHello, I am a test file\nWoow, a new line", solution.cat2(filenames))
Ejemplo n.º 9
0
 def test_cat2(self):
     self.assertEqual(['tests','test2'], solution.cat2(self.array))
 def test_cat2_for_more_files(self):
     self.assertEqual("This is content of text1.txt.\nThis is content of text2.txt.", cat2(["text1.txt", "text2.txt"]))
 def test_cat2_for_one_file(self):
     self.assertEqual("This is content of text1.txt.", cat2(["text1.txt"]))
Ejemplo n.º 12
0
 def test_cat2_for_more_files(self):
     self.assertEqual(
         "This is content of text1.txt.\nThis is content of text2.txt.",
         cat2(["text1.txt", "text2.txt"]))
Ejemplo n.º 13
0
 def test_cat2_for_one_file(self):
     self.assertEqual("This is content of text1.txt.", cat2(["text1.txt"]))
Ejemplo n.º 14
0
 def test_cat2(self):
     filenames = [self.filename1, self.filename2, self.filename3]
     self.assertEqual(
         "Hello, I am a test file\n\n\n\nHello, I am a test file\nWoow, a new line",
         solution.cat2(filenames))
Ejemplo n.º 15
0
 def test_cat2(self):
     result = cat2(["test_file1", "test_file2"])
     self.assertEqual("just a simple text for testing" + "\n\nagain just a simple text for testing", result)
Ejemplo n.º 16
0
 def test_cat(self):
     self.assertEqual('\n\n'.join(self.content), solution.cat2())