Example #1
0
    def test_move_conflicts_list_length_1(self, patched_input_still_move):
        # Specify the text string input by the user and returned
        # by the input function (including an extraneous comma to
        # confirm that the extra input is ignored)
        patched_input_still_move.return_value = '1,'

        # Define the expected output based on the user input
        # patched through to the function (using the dummy
        # single-item conflict list)
        expect_keep = []

        # Note that empty move order text is passed to the function
        # since no one will see the messages printed anyway
        keep = run_setup.fix_ecm_move_conflicts(self.conflict_list_l1, '')

        # Compare the expected and actual output - the list
        # of ECMs to keep in place
        self.assertTrue(self.compare(expect_keep, keep))
Example #2
0
    def test_move_conflicts_list_length_1(self, patched_input_still_move):
        # Specify the text string input by the user and returned
        # by the input function (including an extraneous comma to
        # confirm that the extra input is ignored)
        patched_input_still_move.return_value = '1,'

        # Define the expected output based on the user input
        # patched through to the function (using the dummy
        # single-item conflict list)
        expect_keep = []

        # Note that empty move order text is passed to the function
        # since no one will see the messages printed anyway
        keep = run_setup.fix_ecm_move_conflicts(self.conflict_list_l1, '')

        # Compare the expected and actual output - the list
        # of ECMs to keep in place
        self.assertTrue(self.compare(expect_keep, keep))
Example #3
0
    def test_move_conflicts(self, patched_input_still_move):
        # Specify the text string input by the user and returned
        # by the input function
        patched_input_still_move.return_value = '1, 3'

        # Define the expected output based on the user input
        # patched through to the function (using the dummy 4-item
        # conflict list)
        expect_keep = [
            '(Prospective) Silica Nanoparticle Liquid-applied Insulation',
            'Low-cost Prospective Integrated Heat Pump']

        # Note that empty move order text is passed to the function
        # since no one will see the messages printed anyway
        keep = run_setup.fix_ecm_move_conflicts(self.conflict_list_l4, '')

        # Compare the expected and actual output - the list
        # of ECMs to keep in place
        self.assertTrue(self.compare(expect_keep, keep))
Example #4
0
    def test_move_conflicts(self, patched_input_still_move):
        # Specify the text string input by the user and returned
        # by the input function
        patched_input_still_move.return_value = '1, 3'

        # Define the expected output based on the user input
        # patched through to the function (using the dummy 4-item
        # conflict list)
        expect_keep = [
            '(Prospective) Silica Nanoparticle Liquid-applied Insulation',
            'Low-cost Prospective Integrated Heat Pump'
        ]

        # Note that empty move order text is passed to the function
        # since no one will see the messages printed anyway
        keep = run_setup.fix_ecm_move_conflicts(self.conflict_list_l4, '')

        # Compare the expected and actual output - the list
        # of ECMs to keep in place
        self.assertTrue(self.compare(expect_keep, keep))
Example #5
0
    def test_move_conflicts_non_numeric_entry(self, invalid_input, ok_input):
        invalid_input.return_value = 'stuff, 3'
        ok_input.return_value = '2,'

        # Define the expected output based on the user input
        # patched through to the function (using the dummy 4-item
        # conflict list) for the user's "second attempt"
        expect_keep = [
            'Thermoelectric Heat Pump (Prospective)',
            '20 CFM Bathroom Ventilation Fan (Prospective)',
            'Low-cost Prospective Integrated Heat Pump']

        # Call the function under test, passing an empty string for the
        # move direction text since the printed messages are not seen
        # when testing the function
        keep = run_setup.fix_ecm_move_conflicts(self.conflict_list_l4, '')

        # Compare the expected and actual output - the list
        # of ECMs to keep in place
        self.assertTrue(self.compare(expect_keep, keep))
Example #6
0
    def test_move_conflicts_out_of_range_entry(self, err_input, ok_input):
        # Set up patched input with an out of range value input
        # by the user
        err_input.return_value = '1,3,6'
        ok_input.return_value = '1, 3, 4'

        # Define the expected output based on the user input
        # patched through to the function (using the dummy 4-item
        # conflict list) for the user's "second attempt"
        expect_keep = [
            '(Prospective) Silica Nanoparticle Liquid-applied Insulation']

        # Call the function under test, passing an empty string for the
        # move direction text since the printed messages are not seen
        # when testing the function
        keep = run_setup.fix_ecm_move_conflicts(self.conflict_list_l4, '')

        # Compare the expected and actual output - the list
        # of ECMs to keep in place
        self.assertTrue(self.compare(expect_keep, keep))
Example #7
0
    def test_move_conflicts_no_user_selections(self, patched_input_nothing):
        # Specify the text obtained from the user at the input field
        patched_input_nothing.return_value = ''

        # Define the expected output based on the user input
        # patched through to the function (using the dummy
        # 4-item conflict list)
        expect_keep = [
            'Thermoelectric Heat Pump (Prospective)',
            '(Prospective) Silica Nanoparticle Liquid-applied Insulation',
            '20 CFM Bathroom Ventilation Fan (Prospective)',
            'Low-cost Prospective Integrated Heat Pump']

        # Note that empty move order text is passed to the function
        # since no one will see the messages printed anyway
        keep = run_setup.fix_ecm_move_conflicts(self.conflict_list_l4, '')

        # Compare the expected and actual output - the list
        # of ECMs to keep in place
        self.assertTrue(self.compare(expect_keep, keep))
Example #8
0
    def test_move_conflicts_non_numeric_entry(self, invalid_input, ok_input):
        invalid_input.return_value = 'stuff, 3'
        ok_input.return_value = '2,'

        # Define the expected output based on the user input
        # patched through to the function (using the dummy 4-item
        # conflict list) for the user's "second attempt"
        expect_keep = [
            'Thermoelectric Heat Pump (Prospective)',
            '20 CFM Bathroom Ventilation Fan (Prospective)',
            'Low-cost Prospective Integrated Heat Pump'
        ]

        # Call the function under test, passing an empty string for the
        # move direction text since the printed messages are not seen
        # when testing the function
        keep = run_setup.fix_ecm_move_conflicts(self.conflict_list_l4, '')

        # Compare the expected and actual output - the list
        # of ECMs to keep in place
        self.assertTrue(self.compare(expect_keep, keep))
Example #9
0
    def test_move_conflicts_out_of_range_entry(self, err_input, ok_input):
        # Set up patched input with an out of range value input
        # by the user
        err_input.return_value = '1,3,6'
        ok_input.return_value = '1, 3, 4'

        # Define the expected output based on the user input
        # patched through to the function (using the dummy 4-item
        # conflict list) for the user's "second attempt"
        expect_keep = [
            '(Prospective) Silica Nanoparticle Liquid-applied Insulation'
        ]

        # Call the function under test, passing an empty string for the
        # move direction text since the printed messages are not seen
        # when testing the function
        keep = run_setup.fix_ecm_move_conflicts(self.conflict_list_l4, '')

        # Compare the expected and actual output - the list
        # of ECMs to keep in place
        self.assertTrue(self.compare(expect_keep, keep))
Example #10
0
    def test_move_conflicts_no_user_selections(self, patched_input_nothing):
        # Specify the text obtained from the user at the input field
        patched_input_nothing.return_value = ''

        # Define the expected output based on the user input
        # patched through to the function (using the dummy
        # 4-item conflict list)
        expect_keep = [
            'Thermoelectric Heat Pump (Prospective)',
            '(Prospective) Silica Nanoparticle Liquid-applied Insulation',
            '20 CFM Bathroom Ventilation Fan (Prospective)',
            'Low-cost Prospective Integrated Heat Pump'
        ]

        # Note that empty move order text is passed to the function
        # since no one will see the messages printed anyway
        keep = run_setup.fix_ecm_move_conflicts(self.conflict_list_l4, '')

        # Compare the expected and actual output - the list
        # of ECMs to keep in place
        self.assertTrue(self.compare(expect_keep, keep))