From 97842c01b394ffa1c8dbd370271266183192aba5 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 18 Dec 2016 02:47:57 -0500 Subject: [PATCH 01/10] Update README.rst --- README.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.rst b/README.rst index f6e1843..3a08163 100644 --- a/README.rst +++ b/README.rst @@ -71,3 +71,8 @@ Behold, datetimes for humans! Maya hasn't been released yet, but will be very soon! ✨🍰✨ + +☤ Like it? +---------- + +`Say Thanks!`_ From c80ecad67bf7bad1dc9fe958b146c61a41bd7a7c Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 18 Dec 2016 02:48:12 -0500 Subject: [PATCH 02/10] Update README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 3a08163..5c202f6 100644 --- a/README.rst +++ b/README.rst @@ -75,4 +75,4 @@ Maya hasn't been released yet, but will be very soon! ☤ Like it? ---------- -`Say Thanks!`_ +`Say Thanks`_! From a0ab4fc3fb3dd0366c60f534c6214aba773f9526 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 18 Dec 2016 02:48:29 -0500 Subject: [PATCH 03/10] Update README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 5c202f6..f89faa2 100644 --- a/README.rst +++ b/README.rst @@ -75,4 +75,4 @@ Maya hasn't been released yet, but will be very soon! ☤ Like it? ---------- -`Say Thanks`_! +`Say Thanks_`! From 6a4ddff215edbdce4a0f5b8bd5ba87710697b7f9 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 18 Dec 2016 02:48:45 -0500 Subject: [PATCH 04/10] Update README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index f89faa2..7a25374 100644 --- a/README.rst +++ b/README.rst @@ -75,4 +75,4 @@ Maya hasn't been released yet, but will be very soon! ☤ Like it? ---------- -`Say Thanks_`! +`Say Thanks `_! From cc668974b6cc2e36a550a99146fe7265dd55913e Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Sun, 18 Dec 2016 16:03:35 +0800 Subject: [PATCH 05/10] Fix typos --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 7a25374..3ccc8bc 100644 --- a/README.rst +++ b/README.rst @@ -61,9 +61,9 @@ Behold, datetimes for humans! - Complete symmetric import and export of both ISO 8601 and RFC 2822 datetime stamps. - Fantastic parsing of both dates written for/by humans and machines (``maya.when()`` vs ``maya.parse()``). - Support for human slang, both import and export (e.g. `an hour ago`). -- Datetimes can very easily be generated, with our without tzinfo attached. +- Datetimes can very easily be generated, with or without tzinfo attached. - This library is based around epoch time, but dates before Jan 1 1970 are indeed supported, via negative integers. -- Maya never panics, and always carrys a towel. +- Maya never panics, and always carries a towel. ☤ Installing Maya ----------------- From 7ae84f3266fd7a9c4f0ab1de441662137a2c4fa8 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Sun, 18 Dec 2016 16:04:23 +0800 Subject: [PATCH 06/10] Add pip install instruction --- README.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 3ccc8bc..4228c76 100644 --- a/README.rst +++ b/README.rst @@ -68,7 +68,9 @@ Behold, datetimes for humans! ☤ Installing Maya ----------------- -Maya hasn't been released yet, but will be very soon! +.. code-block:: bash + + pip install maya ✨🍰✨ From 8fc07b3ab3f9420558716ac5fb6d7b2b470f6e97 Mon Sep 17 00:00:00 2001 From: Fabrice Laporte Date: Sun, 18 Dec 2016 10:39:43 +0100 Subject: [PATCH 07/10] Update README.rst Typo tomorrrow => tomorrow --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 4228c76..ea830c2 100644 --- a/README.rst +++ b/README.rst @@ -30,7 +30,7 @@ Behold, datetimes for humans! >>> tomorrow.iso8601() '2016-12-16T15:11:30.263350Z' - >>> tomorrrow.rfc2822() + >>> tomorrow.rfc2822() 'Fri, 16 Dec 2016 20:11:30 -0000' >>> tomorrow.datetime() From a562f48e2434bfde2e940e214df6b61fdb72556e Mon Sep 17 00:00:00 2001 From: Timo Furrer Date: Sun, 18 Dec 2016 10:59:22 +0100 Subject: [PATCH 08/10] Fix formatting MayaDT object --- maya.py | 4 ++-- test_maya.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/maya.py b/maya.py index 94d52e5..dce4e3a 100644 --- a/maya.py +++ b/maya.py @@ -34,7 +34,7 @@ class MayaDT(object): def __format__(self, *args, **kwargs): """Return's the datetime's format""" - return self.datetime(*args, **kwargs) + return format(self.datetime(*args, **kwargs)) # Timezone Crap # ------------- @@ -205,4 +205,4 @@ def parse(string): string -- string to be parsed """ dt = dateutil.parser.parse(string) - return MayaDT.from_datetime(dt) \ No newline at end of file + return MayaDT.from_datetime(dt) diff --git a/test_maya.py b/test_maya.py index 8406b6c..390180f 100644 --- a/test_maya.py +++ b/test_maya.py @@ -58,4 +58,9 @@ def test_slang_time(): d = maya.when('one hour ago') assert d.slang_time() == 'an hour ago' + +def test_format(): + d = maya.parse('February 21, 1994') + assert format(d) == format(d.datetime()) + # rand_day = maya.when('2011-02-07', timezone='US/Eastern') From 87013d71e0f17277d408d62f47b1979e20daa203 Mon Sep 17 00:00:00 2001 From: Robert Lechte Date: Sun, 18 Dec 2016 22:38:40 +1100 Subject: [PATCH 09/10] my_modules -> py_modules --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5381108..29f1973 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ setup( author='Kenneth Reitz', author_email='me@kennethreitz.com', url='https://github.com/kennethreitz/maya', - my_modules=['maya'], + py_modules=['maya'], install_requires=required, license='MIT', classifiers=( From c46d9874d46db91ff9527a423fb8e7d3e45dce4a Mon Sep 17 00:00:00 2001 From: Grigouze Date: Sun, 18 Dec 2016 13:24:58 +0100 Subject: [PATCH 10/10] Just add some tests to have full coverage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now it's 💯 % coverage, i don't if it's good or bad but it was easy :) --- test_maya.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/test_maya.py b/test_maya.py index 8406b6c..649b495 100644 --- a/test_maya.py +++ b/test_maya.py @@ -1,3 +1,6 @@ +import pytest +from datetime import datetime + import maya @@ -43,10 +46,29 @@ def test_dt_tz_naive(): def test_random_date(): - d = maya.when('11-17-11') + d = maya.when('11-17-11 08:09:10') assert d.year == 2011 assert d.month == 11 assert d.day == 17 + assert d.hour == 8 + assert d.minute == 9 + assert d.second == 10 + assert d.microsecond == 0 + + +def test_print_date(capsys): + d = maya.when('11-17-11') + + print(d) + out, err = capsys.readouterr() + assert out == '\n' + + assert type(d.__format__()) is datetime + + +def test_invalid_date(): + with pytest.raises(ValueError): + d = maya.when('another day') def test_slang_date():