Total Complexity | 1 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import pytest |
||
2 | |||
3 | import decorateme |
||
4 | |||
5 | |||
6 | class TestReprStr: |
||
7 | def test_underscore(self): |
||
8 | @decorateme.add_reprs(exclude={"_under"}) |
||
9 | class X: |
||
10 | def __init__(self, s): |
||
11 | self.x = s |
||
12 | self.y = "carrot" |
||
13 | self.z = "" |
||
14 | self._under = "missing" |
||
15 | self.__dunder = "missing" |
||
16 | |||
17 | x = X(5) |
||
18 | assert str(x) == 'X(x=5, y="carrot", z="")' |
||
19 | assert repr(x) == 'X(x=5, y="carrot", z="")' |
||
20 | |||
21 | |||
22 | if __name__ == "__main__": |
||
23 | pytest.main() |
||
24 |