File: error_test.py

package info (click to toggle)
pysdl2 0.9.7%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,824 kB
  • sloc: python: 17,244; makefile: 195; sh: 32
file content (31 lines) | stat: -rw-r--r-- 906 bytes parent folder | download
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
31
import sys
import pytest
from sdl2 import SDL_Init, SDL_Quit, error


class TestSDL(object):
    __tags__ = ["sdl"]

    @classmethod
    def setup_class(cls):
        SDL_Init(0)

    @classmethod
    def teardown_class(cls):
        SDL_Quit()

    def test_SDL_ClearError(self):
        error.SDL_ClearError()
        assert error.SDL_GetError() == b""

    def test_SDL_SetError(self):
        assert error.SDL_GetError() == b""
        error.SDL_SetError(b"A Unit Test Error Message")
        assert error.SDL_GetError() == b"A Unit Test Error Message"
        error.SDL_ClearError()
        error.SDL_SetError(b"A Unit Test Error Message")
        assert error.SDL_GetError() == b"A Unit Test Error Message"
        assert error.SDL_GetError() == b"A Unit Test Error Message"
        error.SDL_ClearError()
        error.SDL_SetError(b"123456789")
        assert error.SDL_GetError() == b"123456789"