self.username < other.username
__init__ __str__ __repr__ __lt__ email study_group add_group_member__init__, __str__, and __repr__ are tested again in the OnlineStudent class because they are overridden methods.
students.txt
mcarter,Carter,Marilyn,312/473-4837,1,mcarter@coolmail.net ggraber,Graber,Gary,312/837-2837,3,ggraber@coolmail.net ccarpent,Carpenter,Carrie,312/377-2873,2,ccarpent@coolmail.net ccheng,Cheng,Sam,312/272-4473,1,scheng@coolmail.net obooker,Booker,Olivia,312/928-3980,4,obooker@coolmail.net rscanchez,Sanchez,Ricardo,312/838-9928,2,rsanchez@coolmail.net cdharan,Dharan,Connor,312/263-3922,2,cdharan@coolmail.net yboulet,Boulet,Yvette,312/235-3728,3,yboulet@coolmail.net rbolger,Bolger,Raymond,312/663-3827,4,rbolger@coolmail.net sstrickl,Strickland,Sheryl,312/878-9800,1,sstrickl@coolmail.net
study-groups.txt
ccarpent,yboulet,obooker yboulet,ccarpent,obooker obooker,ccarpent,yboulet ccheng,cdharan,rbolger,ggraber cdharan,rbolger,ggraber,ccheng rbolger,ggraber,ccheng,cdharan ggraber,ccheng,cdharan,rbolger mcarter,sstrickl sstrickl,mcarter

class Student:
def __init__(self, i, last, first, ph,
yr):
self.username = i
self.last_name =
last
self.first_name =
first
self.phone = ph
self.year = yr
def update_year(self):
self.year += 1
class OnlineStudent(Student):
"""This class inherits from Student
class"""
def __init__(self, i, last, first, ph, year,
em):
"""Call parent class
constructor"""
Student.__init__(self,
i, last, first, ph, year)
self.email = em
# Initialize empty study
group array
self.study_group =
[]
def __str__(self):
return self.last_name +
"," + self.first_name
def __lt__(self, other):
return self.username
< other.username
def add_group_member(self, member_id):
# Add the member id to
the study group
self.study_group.append(member_id)
--------------------------------------------------------------------------------------------------------------------------------------
Test2.py
import unittest import Student
class OnlineStudentTest(unittest.TestCase):
def test_email(self):
student = Student.OnlineStudent(1, 'last1', 'first1', 1, 1, "abc@gm.com")
self.assertEqual("abc@gm.com", student.email, "Email not correct")
def test_lt(self):
student1 = Student.OnlineStudent(1, 'last1', 'first1', 1, 1, "abc@gm.com")
student2 = Student.OnlineStudent(2, 'last2', 'first2', 1, 1, "efg@gm.com")
self.assertTrue(student1.__lt__(student2), "Student 1 is less than 2")
def test_str(self):
student1 = Student.OnlineStudent(1, 'last1', 'first1', 1, 1, "abc@gm.com")
self.assertEqual("last1,first1", student1.__str__(), "str function should gives all fields")
def test_add_group_member(self):
year = 1
student = Student.OnlineStudent(1, 'last1', 'first1', 1, 1, "abc@gm.com")
student.add_group_member("1")
self.assertEqual("1", student.study_group[0], "Group member should be added")
in python please I need both unittest and traditional test Goal: Implement and test the OnlineStudent class as shown in...
python programming
Goal: Implement and test the OnlineStudent
class as shown in the Student/OnlineStudent UML Diagram.
Input Files:
students.txt study-groups.txt
The study_group instance variable is a list that contains the
username values of the other members in the student's study
group.
Details:
Implement the OnlineStudent class in the module
onlinestudent.py as specified by the Student/OnlineStudent UML
Diagram. OnlineStudent is the derived class of the base
classStudent.
The __lt__ method for an OnlineStudent object should return
true if
self.username < other.username...
this is written in python
Goal: Implement and test the Onlinestudent class as shown in the Student/OnlineStudent UML Diagram Relevant Examples: EmployeeHierarchy PersonArray Pet Input Files: students.txt study-groups.txt The study_group instance variable is a list that contains the username values of the other members in the student's study group Details: 1. Implement the onlinestudent class in the module onlinestudent.py as specified by the Student/OnlineStudent UML Diagram. Onlinestudent is the derived class of the base class student. 2. The_1t__method for an...
A) Please implement a Python script to define a student class with the following attributes (instance attributes): cwid: student’s CWID first_name : student’s first name last_name: student’s last name gender: student’s gender gpa: student’s gpa Please make these attributes as private ones so they have to be accessed via getter/setter methods or property. For this purpose, please define a getter/setter method and property for each of the attributes. Another thing you need to do is to define a constructor that...
PYTHON 3 Object Oriented Programming
***a9q3.py file below***
class GradeItem(object):
# A Grade Item is anything a course uses in a grading scheme,
# like a test or an assignment. It has a score, which is assessed by
# an instructor, and a maximum value, set by the instructor, and a weight,
# which defines how much the item counts towards a final grade.
def __init__(self, weight, scored=None, out_of=None):
"""
Purpose:
Initialize the GradeItem object.
Preconditions:
:param weight: the weight...