<commit_before>"""Unit tests for the IGCWriter class"""

from nose.tools import assert_equal, raises
from latlon import LatLon


def test_valid():
    """
    Test valid LatLon
    """

    p = LatLon(51, 7)
    assert_equal(p.latitude, 51.0)
    assert_equal(p.longitude, 7.0)

    p = LatLon(-51, 7)
    assert_equal(p.latitude, -51.0)
    assert_equal(p.longitude, 7.0)

    p = LatLon(51, -7)
    assert_equal(p.latitude, 51.0)
    assert_equal(p.longitude, -7.0)


def test_invalid():
    """
    Test invalid LatLon
    """

    p = LatLon(151, 7)
    assert_equal(p.latitude, 151.0)
    assert_equal(p.longitude, 7.0)

    p = LatLon(-51, 700)
    assert_equal(p.latitude, -51.0)
    assert_equal(p.longitude, 700.0)


@raises(ValueError)
def test_exception():
    """
    Test exception 1
    """

    LatLon(91, 7, True)


@raises(ValueError)
def test_exception2():
    """
    Test exception 2
    """

    LatLon(51, 181, True)


@raises(ValueError)
def test_exception3():
    """
    Test exception 3
    """

    LatLon(-91, 7, True)


@raises(ValueError)
def test_exception4():
    """
    Test exception 4
    """

    LatLon(51, -181, True)<commit_msg>geo/test_latlon: Simplified exception tests<commit_after>"""Unit tests for the IGCWriter class"""

from nose.tools import assert_equal, assert_raises
from latlon import LatLon


def test_valid():
    """
    Test valid LatLon
    """

    p = LatLon(51, 7)
    assert_equal(p.latitude, 51.0)
    assert_equal(p.longitude, 7.0)

    p = LatLon(-51, 7)
    assert_equal(p.latitude, -51.0)
    assert_equal(p.longitude, 7.0)

    p = LatLon(51, -7)
    assert_equal(p.latitude, 51.0)
    assert_equal(p.longitude, -7.0)


def test_invalid():
    """
    Test invalid LatLon
    """

    p = LatLon(151, 7)
    assert_equal(p.latitude, 151.0)
    assert_equal(p.longitude, 7.0)

    p = LatLon(-51, 700)
    assert_equal(p.latitude, -51.0)
    assert_equal(p.longitude, 700.0)


def test_exceptions():
    """
    Test exceptions
    """

    assert_raises(ValueError, LatLon, 91, 7, True)
    assert_raises(ValueError, LatLon, 51, 181, True)
    assert_raises(ValueError, LatLon, -91, 7, True)
    assert_raises(ValueError, LatLon, 51, -181, True)
{'fraction_non_alphanumeric': 0.141500904159132, 'fraction_numerical': 0.05922242314647378, 'mean_word_length': 2.923758865248227, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6696009', 'n_tokens_mistral': 962, 'n_tokens_neox': 853, 'n_words': 182}