Just started learning/applying Unittest and I have this class method save():
class A():
__file_path = "file.json"
__objects = {}
def save(self):
"""
serializes __objects to the JSON file: __file_path
Note:
__objects is a dictionary of Keys: numbers
. Values: object of class B with a get_dict() method returning dictionary representation a B.object
"""
for k, v in self.__objects.items():
Dict[k] = v.get_dict()
with open(self.__file_path, 'w') as fd:
json.dump(Dict, fd)
How to approach this method for a unit test?