Пример #1
0
	def test_print_existing_unallocated_to_screen(self):
		self.clear_stores()
		office = Office("NDO4")
		Dojo.add_room(office)
		fellow = Fellow("Xone4", "Ndobile4", "0856443354", "y")
		fellow.register()
		office.allocate_to(fellow)
		fellow = Fellow("Xone5", "Ndobile6", "0856443009", "n")
		fellow.register()
		office.allocate_to(fellow)
		fellow = Fellow("Xone3", "Ndobile3", "0856443344", "y")
		fellow.register()
		output = Room.all_unallocated_persons()
		expected_output = "0856443344, NDOBILE3, XONE3, FELLOW\n"
		self.assertEqual(output, expected_output)
Пример #2
0
def print_unallocated(out, file_name):
    try:
        output = Room.all_unallocated_persons()
        if len(output) > 0:
            if out is True:
                if file_name is not None:
                    Room.to_file(output, file_name)
                    print_pretty(
                        " A list of unallocated persons can be found in the output directory under the file %s.txt"
                        % file_name)
                else:
                    Room.to_file(output)
                    print_pretty(
                        " A list of unallocated persons can be found in the output directory under the file File.txt"
                    )
            else:
                print_pretty(output)
        else:
            print_pretty(" There are no unallocated persons to show")
    except Exception as e:
        print_pretty(str(e))