示例#1
0
    def test_write_file3(self):
        """Function:  test_write_file3

        Description:  Test with writing to file.

        Arguments:

        """

        gen_libs.print_list(self.data, ofile=self.file)

        self.assertTrue(filecmp.cmp(self.file, self.res_file))
示例#2
0
    def test_write_file2(self):
        """Function:  test_write_file2

        Description:  Test with writing to file.

        Arguments:

        """

        gen_libs.print_list(self.data, ofile=self.file)

        self.assertEqual(linecnt(self.file), 1)
示例#3
0
    def test_mode_a_empty5(self):
        """Function:  test_mode_a_empty5

        Description:  Test with file mode of append passing mode.

        Arguments:

        """

        gen_libs.print_list(self.data3, ofile=self.file, mode=self.mode)

        self.assertEqual(linecnt(self.file), 0)
示例#4
0
    def test_write_file(self):
        """Function:  test_write_file

        Description:  Test with writing to file.

        Arguments:

        """

        gen_libs.print_list(self.data, ofile=self.file)

        self.assertTrue(os.path.isfile(self.file))
示例#5
0
    def test_mode_a_empty6(self):
        """Function:  test_mode_a_empty6

        Description:  Test with file mode of append passing mode.

        Arguments:

        """

        gen_libs.print_list(self.data3, ofile=self.file, mode=self.mode)

        self.assertTrue(filecmp.cmp(self.file, self.res_file4))
示例#6
0
    def test_mode_w_default(self):
        """Function:  test_mode_w_default

        Description:  Test with file mode of overwrite using default setting.

        Arguments:

        """

        gen_libs.print_list(self.data2, ofile=self.file)
        gen_libs.print_list(self.data2, ofile=self.file)

        self.assertTrue(os.path.isfile(self.file))
示例#7
0
    def test_mode_w_default2(self):
        """Function:  test_mode_w_default2

        Description:  Test with file mode of overwrite using default setting.

        Arguments:

        """

        gen_libs.print_list(self.data2, ofile=self.file)
        gen_libs.print_list(self.data2, ofile=self.file)

        self.assertEqual(linecnt(self.file), 2)
示例#8
0
    def test_mode_w_default3(self):
        """Function:  test_mode_w_default3

        Description:  Test with file mode of overwrite using default setting.

        Arguments:

        """

        gen_libs.print_list(self.data2, ofile=self.file)
        gen_libs.print_list(self.data2, ofile=self.file)

        self.assertTrue(filecmp.cmp(self.file, self.res_file2))
示例#9
0
    def test_mode_w_passed2(self):
        """Function:  test_mode_w_passed2

        Description:  Test with file mode of overwrite passing mode.

        Arguments:

        """

        gen_libs.print_list(self.data, ofile=self.file, mode=self.mode2)
        gen_libs.print_list(self.data, ofile=self.file, mode=self.mode2)

        self.assertEqual(linecnt(self.file), 1)
示例#10
0
    def test_mode_w_passed3(self):
        """Function:  test_mode_w_passed3

        Description:  Test with file mode of overwrite passing mode.

        Arguments:

        """

        gen_libs.print_list(self.data, ofile=self.file, mode=self.mode2)
        gen_libs.print_list(self.data, ofile=self.file, mode=self.mode2)

        self.assertTrue(filecmp.cmp(self.file, self.res_file))
示例#11
0
    def test_mode_a_passed(self):
        """Function:  test_mode_a_passed

        Description:  Test with file mode of append passing mode.

        Arguments:

        """

        gen_libs.print_list(self.data2, ofile=self.file, mode=self.mode)
        gen_libs.print_list(self.data2, ofile=self.file, mode=self.mode)

        self.assertTrue(os.path.isfile(self.file))
示例#12
0
    def test_mode_w_empty(self):
        """Function:  test_mode_w_empty

        Description:  Test with write mode with empty list.

        Arguments:

        """

        gen_libs.print_list(self.data2, ofile=self.file, mode=self.mode2)
        gen_libs.print_list(self.data3, ofile=self.file, mode=self.mode2)

        self.assertTrue(os.path.isfile(self.file))
示例#13
0
    def test_mode_w_empty2(self):
        """Function:  test_mode_w_empty2

        Description:  Test with write mode with empty list.

        Arguments:

        """

        gen_libs.print_list(self.data2, ofile=self.file, mode=self.mode2)
        gen_libs.print_list(self.data3, ofile=self.file, mode=self.mode2)

        self.assertEqual(linecnt(self.file), 0)
示例#14
0
    def test_mode_w_empty3(self):
        """Function:  test_mode_w_empty3

        Description:  Test with write mode with empty list.

        Arguments:

        """

        gen_libs.print_list(self.data2, ofile=self.file, mode=self.mode2)
        gen_libs.print_list(self.data3, ofile=self.file, mode=self.mode2)

        self.assertTrue(filecmp.cmp(self.file, self.res_file4))
示例#15
0
    def test_mode_a_empty4(self):
        """Function:  test_mode_a_empty4

        Description:  Test with append mode with empty list.

        Arguments:

        """

        gen_libs.print_list(self.data2, ofile=self.file, mode=self.mode)
        gen_libs.print_list(self.data3, ofile=self.file, mode=self.mode)

        self.assertTrue(os.path.isfile(self.file))
示例#16
0
    def test_mode_w_passed(self):
        """Function:  test_mode_w_passed

        Description:  Test with file mode of overwrite passing mode.

        Arguments:

        """

        gen_libs.print_list(self.data, ofile=self.file, mode=self.mode2)
        gen_libs.print_list(self.data, ofile=self.file, mode=self.mode2)

        self.assertTrue(os.path.isfile(self.file))
示例#17
0
    def test_std_out3(self):
        """Function:  test_std_out3

        Description:  Test with empty list.

        Arguments:

        """

        self.assertFalse(gen_libs.print_list(self.data3))
示例#18
0
    def test_std_out(self):
        """Function:  test_std_out

        Description:  Test with printing to standard out.

        Arguments:

        """

        with gen_libs.no_std_out():
            self.assertFalse(gen_libs.print_list(self.data))