Skip to content

Commit b85db55

Browse files
committed
Added unittest infos
1 parent 6117068 commit b85db55

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

docs/Printers.md

+13-3
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,36 @@
22

33
OK, so you want to add a new output format. Very good! Here's how you do it.
44

5-
* Add the new command-line option to the printer group.
5+
Add the new command-line option to the printer group.
66

77
```python
88
help_MyNewPrinter = "The most awesome printer to exist in the observable universe"
99
printertype.add_argument('-x', help=help_MyNewPrinter, action='store_const', dest='printer', const='MyNewPrinter')
1010
```
1111

12-
* Create a new Printer subclass based on the name you just added. It should the implement the printsheet method.
12+
Create a new Printer subclass based on the name you just added. It should the implement the printsheet method.
1313

1414
```python
1515
class MyNewPrinter(Printer):
1616
[...]
1717
```
1818

1919

20-
* Add the new Printer type to the PrinterFactory, so the new Printer object can be instantiated.
20+
Add the new Printer type to the PrinterFactory, so the new Printer object can be instantiated.
2121

2222
```python
2323
printer_classes = {
2424
[...]
2525
"MyNewPrinter": MyNewPrinter,
2626
}
2727
```
28+
29+
Extend the unittest to include the new Printer type
30+
31+
```python
32+
def test_PrinterFactory_MyNewPrinter(self):
33+
self.assertIs(
34+
cp.PrinterFactory.create_printer("MyNewPrinterPrinter"),
35+
cp.MyNewPrinter
36+
)
37+
```

0 commit comments

Comments
 (0)