File: test_exceptions.py

package info (click to toggle)
einsteinpy 0.4.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 40,712 kB
  • sloc: python: 8,196; makefile: 146
file content (43 lines) | stat: -rw-r--r-- 879 bytes parent folder | download | duplicates (2)
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
32
33
34
35
36
37
38
39
40
41
42
43
import pytest

from einsteinpy.utils import CoordinateError


def test_CoordinateError_class():
    """
    Tests, if the errors raised with the CoordinateError class \
    ``einsteinpy.coordinates.utils.CoordinateError`` are \
    appropriate

    """
    err_string = " ".join(
        str(i)
        for i in [
            "Error",
            404,
            chr(0xA),
            "\bPage Found =",
            False,
            "\b, Please contact :",
            11.223344,
            None,
            0x1F76,
            12e-4,
        ]
    )
    err = CoordinateError(
        "Error",
        404,
        chr(0xA),
        "\bPage Found =",
        False,
        "\b, Please contact :",
        11.223344,
        None,
        0x1F76,
        12e-4,
    )

    assert hasattr(err, "message")
    assert str(err) == repr(err)
    assert err_string == err.message