| 4 | from validate import String, PositiveInteger, PositiveFloat |
| 5 | |
| 6 | class Stock(Structure): |
| 7 | name = String('name') |
| 8 | shares = PositiveInteger('shares') |
| 9 | price = PositiveFloat('price') |
| 10 | |
| 11 | @property |
| 12 | def cost(self): |
| 13 | return self.shares * self.price |
| 14 | |
| 15 | def sell(self, nshares): |
| 16 | self.shares -= nshares |
| 17 | |
| 18 | if __name__ == '__main__': |
| 19 | from reader import read_csv_as_instances |
nothing calls this directly
no test coverage detected