예제 #1
0
    def test_load_str(self):
        """Function:  test_load_str

        Description:  Test loading from a sting.

        Arguments:

        """

        log = gen_class.LogFile()
        log.load_keyword(self.input_str)

        self.assertEqual(log.keyword, self.result_str)
예제 #2
0
    def test_default(self):
        """Function:  test_default

        Description:  Test get_marker method with default settings.

        Arguments:

        """

        log = gen_class.LogFile()
        log.loglist = self.loglist

        self.assertEqual(log.get_marker(), self.results)
예제 #3
0
    def test_load_str_single(self):
        """Function:  test_load_str_single

        Description:  Test loading from a single sting.

        Arguments:

        """

        log = gen_class.LogFile()
        log.load_marker(self.input_str)

        self.assertEqual(log.marker, self.result_str)
예제 #4
0
    def test_set_predicate_all(self):
        """Function:  test_set_predicate_all

        Description:  Test with with all value.

        Arguments:

        """

        log = gen_class.LogFile()
        log.set_predicate("and")

        self.assertEqual(log.predicate, all)
예제 #5
0
    def test_set_predicate_any(self):
        """Function:  test_set_predicate_any

        Description:  Test with with any value.

        Arguments:

        """

        log = gen_class.LogFile()
        log.set_predicate("or")

        self.assertEqual(log.predicate, any)
예제 #6
0
    def test_set_predicate_invalid(self):
        """Function:  test_set_predicate_invalid

        Description:  Test with invalid value.

        Arguments:

        """

        log = gen_class.LogFile()
        log.set_predicate("invalid")

        self.assertEqual(log.predicate, any)
예제 #7
0
    def test_load_str_multiple_raw(self):
        """Function:  test_load_str_multiple_raw

        Description:  Test loading from a multiple line raw stings.

        Arguments:

        """

        log = gen_class.LogFile()
        log.load_regex(self.input_str3)

        self.assertEqual(log.regex, self.result_str3)
    def test_load_empty_str(self):
        """Function:  test_load_empty_str

        Description:  Test loading from an empty sting.

        Arguments:

        """

        log = gen_class.LogFile()
        log.load_loglist("")

        self.assertEqual((log.loglist, log.lastline), ([""], ""))
    def test_load_empty_dict(self):
        """Function:  test_load_empty_dict

        Description:  Test loading from an empty dictionary.

        Arguments:

        """

        log = gen_class.LogFile()
        log.load_loglist({}, dictkey="lines")

        self.assertEqual((log.loglist, log.lastline), ([], None))
예제 #10
0
    def test_load_dict_no_key(self):
        """Function:  test_load_empty_dict

        Description:  Test loading from a dictionary with no key passed.

        Arguments:

        """

        log = gen_class.LogFile()
        log.load_loglist(self.input_dict)

        self.assertEqual((log.loglist, log.lastline), ([], None))
예제 #11
0
    def test_load_empty_list(self):
        """Function:  test_load_empty_list

        Description:  Test loading from an empty list.

        Arguments:

        """

        log = gen_class.LogFile()
        log.load_loglist([])

        self.assertEqual((log.loglist, log.lastline), ([], None))
예제 #12
0
    def test_empty(self):
        """Function:  test_empty

        Description:  Test with empty loglist.

        Arguments:

        """

        log = gen_class.LogFile()
        log.loglist = []

        self.assertEqual(log.get_marker(), None)
예제 #13
0
    def test_load_list(self):
        """Function:  test_load_list

        Description:  Test loading from a list.

        Arguments:

        """

        log = gen_class.LogFile()
        log.load_regex(self.input_list)

        self.assertEqual(log.regex, self.result_str)
예제 #14
0
    def test_load_empty_list(self):
        """Function:  test_load_empty_list

        Description:  Test loading from an empty list.

        Arguments:

        """

        log = gen_class.LogFile()
        log.load_regex([])

        self.assertEqual(log.regex, "")
예제 #15
0
    def test_load_empty_str(self):
        """Function:  test_load_empty_str

        Description:  Test loading from an empty sting.

        Arguments:

        """

        log = gen_class.LogFile()
        log.load_regex("")

        self.assertEqual(log.regex, "")
예제 #16
0
    def test_load_empty_file(self):
        """Function:  test_load_empty_file

        Description:  Test loading from an empty file.

        Arguments:

        """

        log = gen_class.LogFile()
        finst = open(self.input_file2)
        log.load_loglist(finst)

        self.assertEqual((log.loglist, log.lastline), ([], None))
예제 #17
0
    def test_load_dict_str(self):
        """Function:  test_load_dict_str

        Description:  Test loading from a dictionary with a string.

        Arguments:

        """

        log = gen_class.LogFile()
        log.load_loglist(self.input_dict2, dictkey="lines")

        self.assertEqual((log.loglist, log.lastline),
                         (self.result_dict2, self.result_dict2[-1]))
예제 #18
0
    def test_load_empty_str(self):

        """Function:  test_load_empty_str

        Description:  Test loading ignore from an empty sting.

        Arguments:

        """

        log = gen_class.LogFile()
        log.load_ignore("")

        self.assertEqual(log.ignore, [""])
예제 #19
0
    def test_load_file(self):
        """Function:  test_load_file

        Description:  Test loading from a file.

        Arguments:

        """

        log = gen_class.LogFile()
        finst = open(self.input_file)
        log.load_keyword(finst)

        self.assertEqual(log.keyword, self.result_file)
예제 #20
0
    def test_load_list(self):
        """Function:  test_load_list

        Description:  Test loading from a list.

        Arguments:

        """

        log = gen_class.LogFile()
        log.load_loglist(self.input_list)

        self.assertEqual((log.loglist, log.lastline),
                         (self.result_list, self.result_list[-1]))
예제 #21
0
    def test_load_empty_file(self):
        """Function:  test_load_empty_file

        Description:  Test loading from an empty file.

        Arguments:

        """

        log = gen_class.LogFile()
        finst = open(self.input_file2)
        log.load_regex(finst)

        self.assertEqual(log.regex, "")
예제 #22
0
    def test_load_str_single(self):
        """Function:  test_load_str_single

        Description:  Test loading from a single sting.

        Arguments:

        """

        log = gen_class.LogFile()
        log.load_loglist(self.input_str)

        self.assertEqual((log.loglist, log.lastline),
                         (self.result_str, self.result_str[-1]))
예제 #23
0
    def test_load_file_multiple(self):
        """Function:  test_load_file

        Description:  Test loading from a file multiple lines.

        Arguments:

        """

        log = gen_class.LogFile()
        finst = open(self.input_file3)
        log.load_regex(finst)

        self.assertEqual(log.regex, self.result_str2)
예제 #24
0
    def test_load_empty_list(self):

        """Function:  test_load_empty_list

        Description:  Test loading ignore from an empty list.

        Arguments:

        """

        log = gen_class.LogFile()
        log.load_ignore([])

        self.assertEqual(log.ignore, [])
예제 #25
0
    def test_empty_log(self):
        """Function:  test_empty_log

        Description:  Test with empty loglist.

        Arguments:

        """

        log = gen_class.LogFile()
        log.marker = self.marker

        log.find_marker()
        self.assertEqual((log.loglist, log.linemarker), ([], None))
예제 #26
0
    def test_empty_marker(self):
        """Function:  test_empty_marker

        Description:  Test with empty marker.

        Arguments:

        """

        log = gen_class.LogFile()
        log.loglist = self.loglist

        log.find_marker()
        self.assertEqual((log.loglist, log.linemarker), (self.loglist, None))
예제 #27
0
    def test_default(self):
        """Function:  test_default

        Description:  Test __init__ method with default arguments.

        Arguments:

        """

        log = gen_class.LogFile()

        self.assertEqual((log.loglist, log.regex, log.marker, log.linemarker,
                          log.keyword, log.ignore),
                         ([], None, None, None, [], []))
예제 #28
0
    def test_update_arg(self):
        """Function:  test_update_arg

        Description:  Test with update argument set to True.

        Arguments:

        """

        log = gen_class.LogFile()
        log.loglist = self.loglist
        log.marker = self.marker

        log.find_marker(update=True)
        self.assertEqual((log.loglist, log.linemarker), (self.result, 0))
예제 #29
0
    def test_no_find(self):
        """Function:  test_no_find

        Description:  Test with no marker found.

        Arguments:

        """

        log = gen_class.LogFile()
        log.loglist = self.loglist
        log.marker = self.marker2

        log.find_marker()
        self.assertEqual((log.loglist, log.linemarker), (self.loglist, None))
    def test_case_insensitive(self):
        """Function:  test_case_insensitive

        Description:  Test with case insensitive ignore.

        Arguments:

        """

        log = gen_class.LogFile()
        log.loglist = self.loglist2

        log.load_ignore(self.ignore3)
        log.filter_ignore()
        self.assertEqual(log.loglist, self.result4)