def applying_raise_test(): emp_1 = Employee('test', 'name', 1000) emp_2 = Employee('tes', 'nam', 100) emp_1.apply_raise() emp_2.apply_raise() assert_equal(emp_1.pay, 1000 * 1.04) assert_equal(emp_2.pay, 100 * 1.04)
def index(): if request.method == 'POST': # grab user input data first = request.form.get('first') last = request.form.get('last') pay = request.form.get('pay') # create employee instance emp = Employee(first, last, pay) # add employee instance to list (database) names.append(emp) # render page return render_template('form.html', title='Add Employee')
def declaring_instance_test(): emp_1 = Employee('test', 'name', 1000) emp_2 = Employee('tes', 'nam', 100) assert_equal(emp_1.fullname(), 'test name') assert_equal(emp_2.fullname(), 'tes nam')
from employee.employee import Employee, Boss if __name__ == '__main__': employee_1 = Employee('Damian', 27, 1000, 'podstawowe') employee_1.introduce_yourself() employee_2 = Employee('Adam', 40, 2000, 'średnie') employee_2.introduce_yourself() employee_3 = Employee('Piotr', 24, 1500, 'średnie') employee_3.introduce_yourself() boss = Boss('Arek', 55, 5000, 'Jestem tu bossem') boss.introduce_yourself() boss.add_employee(employee_1) boss.add_employee(employee_2) boss.add_employee(employee_3) print(boss.employee_list)
from employee.employee import Employee roman = Employee("Roman", 1) print(roman.name) print(roman.displayCount()) print(roman.displayEmployee()) roman. Roman.
def add_tabs(self): """ adds new tabs """ global logger if ('Inventory', True) in self.access: logger.info('initiating Inventory') icon = QIcon() icon.addPixmap(QPixmap(":/images/inventory.png"), QIcon.Normal, QIcon.Off) from inventory.inventory import Inventory inventory = Inventory() # inventory.inventory_tab_1.setToolTip("Inventory Section") self.main_tabWidget.addTab(inventory.inventory_tab_1, icon, "") inventory.inventory_detail_tabWidget.setCurrentIndex(0) else: self.inventory_frame_1.setVisible(False) self.progress.setLabelText('Inventory Done....') self.progress.setValue(2) if ('Billing', True) in self.access: logger.info('initiating Billing') icon1 = QIcon() icon1.addPixmap(QPixmap(":/images/billing.png"), QIcon.Normal, QIcon.Off) from billing.billing import Billing bill = Billing() # bill.billing_tab_2.setToolTip("Billing Section") self.main_tabWidget.addTab(bill.billing_tab_2, icon1, "") bill.billing_detail_tabWidget.setCurrentIndex(0) else: self.billing_frame_2.setVisible(False) self.progress.setLabelText('Billing Done...') self.progress.setValue(3) if ('Employee', True) in self.access: logger.info('initiating Employee') icon2 = QIcon() icon2.addPixmap(QPixmap(":/images/employee.png"), QIcon.Normal, QIcon.Off) from employee.employee import Employee employee = Employee() # employee.employee_tab_3.setToolTip("Employee Section") self.main_tabWidget.addTab(employee.employee_tab_3, icon2, "") employee.employee_detail_tabWidget.setCurrentIndex(0) else: self.employee_frame_3.setVisible(False) self.progress.setLabelText('Employee Done...') self.progress.setValue(4) if ('Menu', True) in self.access: logger.info('initiating Menu') icon3 = QIcon() icon3.addPixmap(QPixmap(":/images/menu.png"), QIcon.Normal, QIcon.Off) from menu.menu import Menu menu = Menu() # menu.menu_tab_4.setToolTip("Menu Section") self.main_tabWidget.addTab(menu.menu_tab_4, icon3, "") menu.menu_detail_tabWidget.setCurrentIndex(0) else: self.menu_frame_4.setVisible(False) self.progress.setLabelText('Menu Done....') self.progress.setValue(5) if ('Report', True) in self.access: logger.info('initiating Report') icon4 = QIcon() icon4.addPixmap(QPixmap(":/images/report.png"), QIcon.Normal, QIcon.Off) from report.report import Report report = Report() # report.report_tab_5.setToolTip("Report Section") self.main_tabWidget.addTab(report.report_tab_5, icon4, "") report.report_detail_tabWidget.setCurrentIndex(0) else: self.report_frame_5.setVisible(False) self.progress.setLabelText('Report Done....') self.progress.setValue(6) if ('Waste', True) in self.access: logger.info('initiating Waste') icon5 = QIcon() icon5.addPixmap(QPixmap(":/images/waste.png"), QIcon.Normal, QIcon.Off) from waste.waste import Waste waste = Waste() # waste.waste_tab_6.setToolTip("Waste Section") self.main_tabWidget.addTab(waste.waste_tab_6, icon5, "") waste.waste_detail_tabWidget.setCurrentIndex(0) else: self.waste_frame_6.setVisible(False) self.progress.setLabelText('Waste Done....') self.progress.setValue(7)
from employee.employee import Employee, Developer, SalesPerson employee_1 = Employee('joe', 'bloggs', 2) employee_2 = Employee('tom', 'smith', 5) employee_3 = Employee('alice', 'jones', 6) print(employee_1.get_details()) print(employee_2.get_details()) print(employee_3.get_details() + "\n") developer_1 = Developer('tim', 'brown', 2, 'python') developer_2 = Developer('joe', 'smith', 5, 'Javascript') developer_3 = Developer('bob', 'brown', 6, 'HTML') print(developer_1.get_details()) print(developer_2.get_details()) print(developer_3.get_details() + "\n") sales_1 = SalesPerson('tim', 'brown', 2, 'uk') sales_2 = SalesPerson('joe', 'smith', 5, 'ireland') sales_3 = SalesPerson('bob', 'brown', 6, 'europe') print(sales_1.get_details()) print(sales_2.get_details()) print(sales_3.get_details())