File: test_boolobject.py

package info (click to toggle)
pypy3 7.3.19%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 212,236 kB
  • sloc: python: 2,098,316; ansic: 540,565; sh: 21,462; asm: 14,419; cpp: 4,451; makefile: 4,209; objc: 761; xml: 530; exp: 499; javascript: 314; pascal: 244; lisp: 45; csh: 12; awk: 4
file content (30 lines) | stat: -rw-r--r-- 1,016 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class TestW_BoolObject:
    def setup_method(self,method):
        self.true = self.space.w_True
        self.false = self.space.w_False
        self.wrap = self.space.wrap

    def test_init(self):
        assert (self.false.intval, type(self.false.intval)) == (0, int)
        assert (self.true.intval, type(self.true.intval)) == (1, int)

    def test_repr(self):
        assert self.space.eq_w(self.space.repr(self.true), self.wrap("True"))
        assert self.space.eq_w(self.space.repr(self.false), self.wrap("False"))

    def test_true(self):
        assert self.space.is_true(self.true)

    def test_false(self):
        assert not self.space.is_true(self.false)

    def test_int_w(self):
        assert self.space.int_w(self.true) is 1
        assert self.space.int_w(self.false) is 0

    def test_uint_w(self):
        assert self.space.uint_w(self.true) == 1
        assert self.space.uint_w(self.false) == 0

    def test_rbigint_w(self):
        assert self.space.bigint_w(self.true)._digits == [1]