Assignment - AriosJentu/TestingDocumentGenerator GitHub Wiki
There is some information about assignment class.
Classes
There is only one basic class to work with document entries:
Assignment— parent class from which you can create your own assignment.
Usage in Assignment definitions
Assignment class can be obtained with importing Imports module from Modules:
import Modules.Imports as Imports
This class contained in Imports.Assignments module.
Inheritance Assignment
To generate your own assignment, need to inherit class Assignment with new class name, which would satisfies your assignment. There is no initialization function, only parameters of the class, which are next:
layout— object of classDocumentLayoutwith information about document and it's pages (information can be read here).test— object of classTestwith information about all exercises in this assignment (information can be read here).entries— object of classEntries. By default replaced in generation with script arguments, and doesn't need to be defined (read usage).document_entries— object of classDocumentEntrieswith information about page layout entries (information can be read here).prefix— string with document'sfilenameprefix. Can be any string. If document created with prefix in name (by default it'sTrue), it will be added in front of document'sfilename.number— number of the document of this prefix classification. Used in parsing ofusage-arguments. Should be without any conflicts with this index on the same assignment keys (about assignment keys read here).generation_folder— string of the folder where documents will be generated. By default it'sGeneratedfolder at the top of the project.
Usage:
control_event = "My First Assignment"
event_number = 1
my_layout = Imports.Documents.DocumentLayout(layout_location, page_style)
document_test = Imports.Tests.Test([exercise1, exercise2, exercise3])
document_entries = Imports.Entries.DocumentEntries(control_event=control_event, event_number=event_number)
class MyAssignment(Imports.Assignments.Assignment):
layout = my_layout
test = document_test
document_entries = document_entries
prefix = "assignment"
number = event_number
Then this assignment can be imported in AssignmentsInformation object of the current module.
More examples of the assignment definitions can be found on tests branch, for example — here and here.