Skip to content

Commit dfd0ea2

Browse files
committed
int type: Added tests for the __rxor__
1 parent b682eb9 commit dfd0ea2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/snippets/numbers.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
assert int.__doc__ == "int(x=0) -> integer\nint(x, base=10) -> integer\n\nConvert a number or string to an integer, or return 0 if no arguments\nare given. If x is a number, return x.__int__(). For floating point\nnumbers, this truncates towards zero.\n\nIf x is not a number or if base is given, then x must be a string,\nbytes, or bytearray instance representing an integer literal in the\ngiven base. The literal can be preceded by '+' or '-' and be surrounded\nby whitespace. The base defaults to 10. Valid bases are 0 and 2-36.\nBase 0 means to interpret the base from the string as an integer literal.\n>>> int('0b100', base=0)\n4"
66

7+
78
class A(int):
89
pass
910

11+
1012
x = A(7)
1113
assert x == 7
1214
assert type(x) is A
@@ -18,3 +20,10 @@ class A(int):
1820
assert int(0).__invert__() == -1
1921
assert int(-3).__invert__() == 2
2022
assert int(4).__invert__() == -5
23+
24+
assert int(0).__rxor__(0) == 0
25+
assert int(1).__rxor__(0) == 1
26+
assert int(0).__rxor__(1) == 1
27+
assert int(1).__rxor__(1) == 0
28+
assert int(3).__rxor__(-3) == -2
29+
assert int(3).__rxor__(4) == 7

0 commit comments

Comments
 (0)