示例#1
0
    def test_peek_next_ubyte_with_negative(self):
        x = ByteScanner("Hi \n")

        x.read_ubyte()
        x.read_ubyte()

        self.assertEquals(x.peek_next_ubyte(-1), "i")
        self.assertEquals(x.peek_next_ubyte(-2), "H")
        self.assertEquals(x.peek_next_ubyte(-3, none_if_bad_index=True), None)
        self.assertRaises(IndexError, x.peek_next_ubyte, (-3))
示例#2
0
    def test_peek_next_ubyte_with_negative(self):
        x = ByteScanner("Hi \n")

        x.read_ubyte()
        x.read_ubyte()

        self.assertEquals(x.peek_next_ubyte(-1), "i")
        self.assertEquals(x.peek_next_ubyte(-2), "H")
        self.assertEquals(x.peek_next_ubyte(-3, none_if_bad_index=True), None)
        self.assertRaises(IndexError, x.peek_next_ubyte, (-3))
示例#3
0
    def test_peek_next_ubyte(self):
        x = ByteScanner("Hi \n")

        x.read_ubyte()
        x.read_ubyte()

        self.assertEquals(x.peek_next_ubyte(), " ")
        self.assertEquals(x.peek_next_ubyte(1), "\n")
        self.assertEquals(x.peek_next_ubyte(2, none_if_bad_index=True), None)
        self.assertRaises(IndexError, x.peek_next_ubyte, 2)
示例#4
0
    def test_peek_next_ubyte(self):
        x = ByteScanner("Hi \n")

        x.read_ubyte()
        x.read_ubyte()

        self.assertEquals(x.peek_next_ubyte(), " ")
        self.assertEquals(x.peek_next_ubyte(1), "\n")
        self.assertEquals(x.peek_next_ubyte(2, none_if_bad_index=True), None)
        self.assertRaises(IndexError, x.peek_next_ubyte, 2)