Ejemplo n.º 1
0
def test_read_invalid():
    reader = Reader()
    local_path = os.path.join(os.path.split(__file__)[0], '..')
    tz_file = os.path.join(local_path, 'fixtures', 'tz', 'NOT_A_TIMEZONE')

    with pytest.raises(InvalidZoneinfoFile):
        reader.read(tz_file)
Ejemplo n.º 2
0
def test_read_invalid():
    reader = Reader()
    local_path = os.path.join(os.path.split(__file__)[0], "..")
    tz_file = os.path.join(local_path, "fixtures", "tz", "NOT_A_TIMEZONE")

    with pytest.raises(InvalidZoneinfoFile):
        reader.read(tz_file)
Ejemplo n.º 3
0
def test_read():
    reader = Reader()
    local_path = os.path.join(os.path.split(__file__)[0], '..', '..')
    tz_file = os.path.join(local_path, 'fixtures', 'tz', 'Paris')
    tz = reader.read(tz_file)

    assert len(tz.transitions) > 0
Ejemplo n.º 4
0
def test_read():
    reader = Reader()
    local_path = os.path.join(os.path.split(__file__)[0], "..", "..")
    tz_file = os.path.join(local_path, "fixtures", "tz", "Paris")
    tz = reader.read(tz_file)

    assert len(tz.transitions) > 0
Ejemplo n.º 5
0
def test_read_for_bad_timezone():
    reader = Reader()
    with pytest.raises(InvalidTimezone):
        reader.read_for('---NOT A TIMEZONE---')
Ejemplo n.º 6
0
def test_set_transitions_for_no_transition_database_file():
    reader = Reader()
    tz = reader.read_for('Etc/UTC')

    assert len(tz.transitions) == 1
Ejemplo n.º 7
0
def test_read_for_valid():
    reader = Reader()

    tz = reader.read_for('America/Toronto')
    assert isinstance(tz, Timezone)
Ejemplo n.º 8
0
def test_read_for_bad_timezone():
    reader = Reader()
    with pytest.raises(InvalidTimezone):
        reader.read_for("---NOT A TIMEZONE---")
Ejemplo n.º 9
0
def test_set_transitions_for_no_transition_database_file():
    reader = Reader()
    tz = reader.read_for("Etc/UTC")

    assert len(tz.transitions) == 1
Ejemplo n.º 10
0
def test_read_for_valid():
    reader = Reader()

    tz = reader.read_for("America/Toronto")
    assert isinstance(tz, Timezone)