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