Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_not_equal_to_true():
d1 = pendulum.Date(2000, 1, 1)
d2 = pendulum.Date(2000, 1, 2)
d3 = date(2000, 1, 2)
assert d1 != d2
assert d1 != d3
def test_for_json():
d = pendulum.Date(1975, 12, 25)
assert d.for_json() == "1975-12-25"
def test_week_of_year_last_week():
assert pendulum.Date(2012, 12, 30).week_of_year == 52
assert pendulum.Date(2012, 12, 31).week_of_year == 1
def test_closest_with_equals():
instance = pendulum.Date(2015, 5, 28)
dt1 = pendulum.Date(2015, 5, 28)
dt2 = pendulum.Date(2015, 5, 30)
closest = instance.closest(dt1, dt2)
assert closest == dt1
def test_less_than_true():
d1 = pendulum.Date(2000, 1, 1)
d2 = pendulum.Date(2000, 1, 2)
d3 = date(2000, 1, 2)
assert d1 < d2
assert d1 < d3
def test_is_long_year():
assert pendulum.Date(2015, 1, 1).is_long_year()
assert not pendulum.Date(2016, 1, 1).is_long_year()
def test_format_with_locale():
d = pendulum.Date(1975, 12, 25)
expected = u"jeudi 25e jour de décembre 1975"
assert d.format("dddd Do [jour de] MMMM YYYY", locale="fr") == expected
def test_fluid_month_setter():
d = pendulum.Date(2016, 7, 2)
new = d.set(month=11)
assert new.month == 11
assert d.month == 7
def test_today():
d = Date.today()
assert isinstance(d, Date)
def test_pickle():
d1 = pendulum.Date(2016, 8, 27)
s = pickle.dumps(d1)
d2 = pickle.loads(s)
assert isinstance(d2, pendulum.Date)
assert d2 == d1