Ejemplo n.º 1
0
    def test_parse_string(self):
        ads = ADSIO()
        test1_answer = False
        test2_answer = False
        test3_answer = False

        # returns a list.
        test_list = ads.parse_string(self.__sampleData)

        if test_list is None:
            test1_answer = False

        # makes sure each part of both lists are the same.
        if set(test_list) == set(self.__sample_data_list):
            test1_answer = True

        else:
            test1_answer = False

        # -----------------------------------------------------------------------------

        # testing with bad data...
            # returns a list.
        test_list = ads.parse_string(self.__bad_sample_data)

        if test_list is None:
            test2_answer = True

        # makes sure each part of both lists are not the same.
        if set(test_list) != set(self.__sample_data_list):
            test2_answer = True
        else:
            test2_answer = False

        # -----------------------------------------------------------------------------

        # tests for incomplete or missing input data
        # returns a string
        test_list = ads.parse_string(self.__incomplete_sample_data)

        if test_list is None or test_list == "INCOMPLETE":
            test3_answer = True

        print("test_parse_string_good_data: ", test1_answer)
        print("test_parse_string_bad_data: ", test2_answer)
        print("Incomplete data: ", test3_answer)
Ejemplo n.º 2
0
    def test_parse_string(self):
        ads = ADSIO()

        # makes sure each part of both lists are the same.
        self.assertEqual(self.__sample_data_list, ads.parse_string(self.__sampleData), 'Test 1 failed.')

        # -----------------------------------------------------------------------------

        # testing with bad data...
        # returns a list.

        self.assertFalse(ads.parse_string(self.__bad_sample_data), 'Test 2 failed.')

        # -----------------------------------------------------------------------------

        # tests for incomplete or missing input data
        # returns a string

        self.assertFalse(ads.parse_string(self.__incomplete_sample_data), 'Test 3 failed.')