import pytest import resumejson_converter.filters as filters def test_datediff_only_one_parameter(): with pytest.raises(TypeError): filters.datediff() def test_datediff_only_one_parameter(): with pytest.raises(TypeError): filters.datediff("Hello World") def test_datediff_only_two_parameter(): with pytest.raises(TypeError): filters.datediff("Hello World", "2019-01-02") def test_datediff_false_end_date(): with pytest.raises(ValueError): filters.datediff("Hello", "2019-01-02", "2019-01-02d") def test_datediff_false_start_date(): with pytest.raises(ValueError): filters.datediff("Hello", "2019-01-02a", "2019-01-02") def test_datediff_one_year(): assert filters.datediff( "Hello World!", "2018-01-02", "2019-01-03" ) == "Hello World! - 1 an" def test_datediff_two_year(): assert filters.datediff( "Hello World!", "2017-01-02", "2019-01-03" ) == "Hello World! - 2 ans" def test_datediff_two_years(): assert filters.datediff( "Hello World!", "2017-01-02", "2019-01-03" ) == "Hello World! - 2 ans" def test_datediff_one_month(): assert filters.datediff( "Hello World!", "2019-01-02", "2019-02-03" ) == "Hello World! - 1 mois" def test_datediff_one_week(): assert filters.datediff( "Hello World!", "2019-01-01", "2019-01-09" ) == "Hello World! - 1 semaine" def test_datediff_two_weeks(): assert filters.datediff( "Hello World!", "2019-01-01", "2019-01-16" ) == "Hello World! - 2 semaines" def test_datediff_two_days(): assert filters.datediff( "Hello World!", "2019-01-02", "2019-01-04" ) == "Hello World! - 2 jours"