Hello community,
here is the log from the commit of package python-humanize for openSUSE:Factory
checked in at 2019-06-06 18:17:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-humanize (Old)
and /work/SRC/openSUSE:Factory/.python-humanize.new.4811 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-humanize"
Thu Jun 6 18:17:09 2019 rev:3 rq:707796 version:0.5.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-humanize/python-humanize.changes
2019-01-03 18:06:22.300154031 +0100
+++
/work/SRC/openSUSE:Factory/.python-humanize.new.4811/python-humanize.changes
2019-06-06 18:17:11.332688373 +0200
@@ -1,0 +2,5 @@
+Wed Jun 5 08:03:04 UTC 2019 - Petr Gajdos <[email protected]>
+
+- test package in %check
+
+-------------------------------------------------------------------
Old:
----
humanize-0.5.1.tar.gz
New:
----
0.5.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-humanize.spec ++++++
--- /var/tmp/diff_new_pack.tFuhV0/_old 2019-06-06 18:17:11.780688241 +0200
+++ /var/tmp/diff_new_pack.tFuhV0/_new 2019-06-06 18:17:11.784688240 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-humanize
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -25,10 +25,13 @@
License: MIT
Group: Development/Languages/Python
URL: http://github.com/jmoiron/humanize
-Source:
https://files.pythonhosted.org/packages/source/h/humanize/%{modname}-%{version}.tar.gz
+Source: https://github.com/jmoiron/humanize/archive/%{version}.tar.gz
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
+# SECTION test requirements
+BuildRequires: %{python_module mock}
+# /SECTION
BuildArch: noarch
%python_subpackages
@@ -47,6 +50,9 @@
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
+%check
+%python_expand $python setup.py test
+
%files %{python_files}
%license LICENCE
%doc README.rst
++++++ humanize-0.5.1.tar.gz -> 0.5.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanize-0.5.1/.gitignore
new/humanize-0.5.1/.gitignore
--- old/humanize-0.5.1/.gitignore 1970-01-01 01:00:00.000000000 +0100
+++ new/humanize-0.5.1/.gitignore 2014-11-13 17:41:57.000000000 +0100
@@ -0,0 +1,8 @@
+tags
+*.py[co]
+*.sw[po]
+*.egg-info*
+*.pot
+docs/_build*
+build
+dist
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanize-0.5.1/.travis.yml
new/humanize-0.5.1/.travis.yml
--- old/humanize-0.5.1/.travis.yml 1970-01-01 01:00:00.000000000 +0100
+++ new/humanize-0.5.1/.travis.yml 2014-11-13 17:41:57.000000000 +0100
@@ -0,0 +1,8 @@
+language: python
+python:
+ - 2.7
+ - 3.3
+ - "pypy"
+
+script: python setup.py test
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanize-0.5.1/PKG-INFO new/humanize-0.5.1/PKG-INFO
--- old/humanize-0.5.1/PKG-INFO 2014-11-13 17:43:10.000000000 +0100
+++ new/humanize-0.5.1/PKG-INFO 1970-01-01 01:00:00.000000000 +0100
@@ -1,117 +0,0 @@
-Metadata-Version: 1.1
-Name: humanize
-Version: 0.5.1
-Summary: python humanize utilities
-Home-page: http://github.com/jmoiron/humanize
-Author: Jason Moiron
-Author-email: [email protected]
-License: MIT
-Description: humanize
- --------
-
- .. image::
https://secure.travis-ci.org/jmoiron/humanize.png?branch=master
- :target: http://travis-ci.org/jmoiron/humanize
-
- This modest package contains various common humanization utilities,
like turning
- a number into a fuzzy human readable duration ('3 minutes ago') or
into a human
- readable size or throughput. It works with python 2.7 and 3.3 and is
localized
- to Russian, French, and Korean.
-
- usage
- -----
-
- Integer humanization::
-
- >>> import humanize
- >>> humanize.intcomma(12345)
- '12,345'
- >>> humanize.intword(123455913)
- '123.5 million'
- >>> humanize.intword(12345591313)
- '12.3 billion'
- >>> humanize.apnumber(4)
- 'four'
- >>> humanize.apnumber(41)
- '41'
-
- Date & time humanization::
-
- >>> import datetime
- >>> humanize.naturalday(datetime.datetime.now())
- 'today'
- >>> humanize.naturalday(datetime.datetime.now() -
datetime.timedelta(days=1))
- 'yesterday'
- >>> humanize.naturalday(datetime.date(2007, 6, 5))
- 'Jun 05'
- >>> humanize.naturaldate(datetime.date(2007, 6, 5))
- 'Jun 05 2007'
- >>> humanize.naturaltime(datetime.datetime.now() -
datetime.timedelta(seconds=1))
- 'a second ago'
- >>> humanize.naturaltime(datetime.datetime.now() -
datetime.timedelta(seconds=3600))
- 'an hour ago'
-
- Filesize humanization::
-
- >>> humanize.naturalsize(1000000)
- '1.0 MB'
- >>> humanize.naturalsize(1000000, binary=True)
- '976.6 KiB'
- >>> humanize.naturalsize(1000000, gnu=True)
- '976.6K'
-
-
- Human readable floating point numbers::
-
- >>> humanize.fractional(1/3)
- '1/3'
- >>> humanize.fractional(1.5)
- '1 1/2'
- >>> humanize.fractional(0.3)
- '3/10'
- >>> humanize.fractional(0.333)
- '1/3'
- >>> humanize.fractional(1)
- '1'
-
- Localization
- ------------
-
- How to change locale in runtime ::
-
- >>> print humanize.naturaltime(datetime.timedelta(seconds=3))
- 3 seconds ago
- >>> _t = humanize.i18n.activate('ru_RU')
- >>> print humanize.naturaltime(datetime.timedelta(seconds=3))
- 3 секунды назад
- >>> humanize.i18n.deactivate()
- >>> print humanize.naturaltime(datetime.timedelta(seconds=3))
- 3 seconds ago
-
- You can pass additional parameter *path* to :func:`activate` to
specify a path to
- search locales in. ::
-
- >>> humanize.i18n.activate('pt_BR')
- IOError: [Errno 2] No translation file found for domain: 'humanize'
- >>> humanize.i18n.activate('pt_BR',
path='path/to/my/portuguese/translation/')
- <gettext.GNUTranslations instance ...>
-
- How to add new phrases to existing locale files ::
-
- $ xgettext -o humanize.pot -k'_' -k'N_' -k'P_:1c,2' -l python
humanize/*.py # extract new phrases
- $ msgmerge -U humanize/locale/ru_RU/LC_MESSAGES/humanize.po
humanize.pot # add them to locale files
- $ msgfmt --check -o
humanize/locale/ru_RU/LC_MESSAGES/humanize{.po,.mo} # compile to binary .mo
-
- How to add new locale ::
-
- $ msginit -i humanize.pot -o humanize/locale/<locale
name>/LC_MESSAGES/humanize.po --locale <locale name>
-
- Where <locale name> is locale abbreviation, eg 'en_GB', 'pt_BR' or
just 'ru', 'fr' etc.
-
-Keywords: humanize time size
-Platform: UNKNOWN
-Classifier: Development Status :: 4 - Beta
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Operating System :: POSIX
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanize-0.5.1/docs/Makefile
new/humanize-0.5.1/docs/Makefile
--- old/humanize-0.5.1/docs/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ new/humanize-0.5.1/docs/Makefile 2014-11-13 17:41:57.000000000 +0100
@@ -0,0 +1,100 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+PAPER =
+BUILDDIR = _build
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes
linkcheck doctest distro zip
+
+help:
+ @echo "Please use \`make <target>' where <target> is one of"
+ @echo " html to make standalone HTML files"
+ @echo " dirhtml to make HTML files named index.html in directories"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " qthelp to make HTML files and a qthelp project"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or
PAPER=letter"
+ @echo " changes to make an overview of all changed/added/deprecated
items"
+ @echo " linkcheck to check all external links for integrity"
+ @echo " doctest to run all doctests embedded in the documentation
(if enabled)"
+
+clean:
+ -rm -rf $(BUILDDIR)/*
+
+html:
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+pickle:
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
+
+json:
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+ @echo
+ @echo "Build finished; now you can run "qcollectiongenerator" with the"
\
+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/django-selector.qhcp"
+ @echo "To view the help file:"
+ @echo "# assistant -collectionFile
$(BUILDDIR)/qthelp/django-selector.qhc"
+
+latex:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+ @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
+ "run these through (pdf)latex."
+
+changes:
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+ @echo
+ @echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+ @echo "Testing of doctests in the sources finished, look at the " \
+ "results in $(BUILDDIR)/doctest/output.txt."
+
+distro: html
+ @echo
+ @echo "Pushing documents to http://dev.jmoiron.net/humanize/"
+ scp -r $(BUILDDIR)/html/* [email protected]:dev.jmoiron.net/humanize/
+
+zip: html
+ @echo
+ @echo "Making zip file 'humanize.zip'"
+ cd $(BUILDDIR)/html/; zip -r 'humanize.zip' *
+ mv $(BUILDDIR)/html/'humanize.zip' .
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/humanize-0.5.1/docs/_theme/nature/static/nature.css_t
new/humanize-0.5.1/docs/_theme/nature/static/nature.css_t
--- old/humanize-0.5.1/docs/_theme/nature/static/nature.css_t 1970-01-01
01:00:00.000000000 +0100
+++ new/humanize-0.5.1/docs/_theme/nature/static/nature.css_t 2014-11-13
17:41:57.000000000 +0100
@@ -0,0 +1,237 @@
+/**
+ * Sphinx stylesheet -- default theme
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+@import url("basic.css");
+
+/* -- page layout -----------------------------------------------------------
*/
+
+body {
+ font-family: Arial, sans-serif;
+ font-size: 100%;
+ background-color: #111111;
+ color: #555555;
+ margin: 0;
+ padding: 0;
+}
+
+div.documentwrapper {
+ float: left;
+ width: 100%;
+}
+
+div.bodywrapper {
+ margin: 0 0 0 300px;
+}
+
+hr{
+ border: 1px solid #B1B4B6;
+}
+
+div.document {
+ background-color: #fafafa;
+}
+
+div.body {
+ background-color: #ffffff;
+ color: #3E4349;
+ padding: 1em 30px 30px 30px;
+ font-size: 0.9em;
+}
+
+div.footer {
+ color: #555;
+ width: 100%;
+ padding: 13px 0;
+ text-align: center;
+ font-size: 75%;
+}
+
+div.footer a {
+ color: #444444;
+}
+
+div.related {
+ background-color: #6BA81E;
+ line-height: 36px;
+ color: #ffffff;
+ text-shadow: 0px 1px 0 #444444;
+ font-size: 1.1em;
+}
+
+div.related a {
+ color: #E2F3CC;
+}
+
+div.related .right {
+ font-size: 0.9em;
+}
+
+div.sphinxsidebar {
+ font-size: 0.9em;
+ line-height: 1.5em;
+ width: 300px
+}
+
+div.sphinxsidebarwrapper{
+ padding: 20px 0;
+}
+
+div.sphinxsidebar h3,
+div.sphinxsidebar h4 {
+ font-family: Arial, sans-serif;
+ color: #222222;
+ font-size: 1.2em;
+ font-weight: bold;
+ margin: 0;
+ padding: 5px 10px;
+ text-shadow: 1px 1px 0 white
+}
+
+div.sphinxsidebar h3 a {
+ color: #444444;
+}
+
+div.sphinxsidebar p {
+ color: #888888;
+ padding: 5px 20px;
+ margin: 0.5em 0px;
+}
+
+div.sphinxsidebar p.topless {
+}
+
+div.sphinxsidebar ul {
+ margin: 10px 10px 10px 20px;
+ padding: 0;
+ color: #000000;
+}
+
+div.sphinxsidebar a {
+ color: #444444;
+}
+
+div.sphinxsidebar a:hover {
+ color: #E32E00;
+}
+
+div.sphinxsidebar input {
+ border: 1px solid #cccccc;
+ font-family: sans-serif;
+ font-size: 1.1em;
+ padding: 0.15em 0.3em;
+}
+
+div.sphinxsidebar input[type=text]{
+ margin-left: 20px;
+}
+
+/* -- body styles -----------------------------------------------------------
*/
+
+a {
+ color: #005B81;
+ text-decoration: none;
+}
+
+a:hover {
+ color: #E32E00;
+}
+
+div.body h1,
+div.body h2,
+div.body h3,
+div.body h4,
+div.body h5,
+div.body h6 {
+ font-family: Arial, sans-serif;
+ font-weight: normal;
+ color: #212224;
+ margin: 30px 0px 10px 0px;
+ padding: 5px 0 5px 0px;
+ text-shadow: 0px 1px 0 white;
+ border-bottom: 1px solid #C8D5E3;
+}
+
+div.body h1 { margin-top: 0; font-size: 200%; }
+div.body h2 { font-size: 150%; }
+div.body h3 { font-size: 120%; }
+div.body h4 { font-size: 110%; }
+div.body h5 { font-size: 100%; }
+div.body h6 { font-size: 100%; }
+
+a.headerlink {
+ color: #c60f0f;
+ font-size: 0.8em;
+ padding: 0 4px 0 4px;
+ text-decoration: none;
+}
+
+a.headerlink:hover {
+ background-color: #c60f0f;
+ color: white;
+}
+
+div.body p, div.body dd, div.body li {
+ line-height: 1.8em;
+}
+
+div.admonition p.admonition-title + p {
+ display: inline;
+}
+
+div.highlight{
+ background-color: white;
+}
+
+div.note {
+ background-color: #eeeeee;
+ border: 1px solid #cccccc;
+}
+
+div.seealso {
+ background-color: #ffffcc;
+ border: 1px solid #ffff66;
+}
+
+div.topic {
+ background-color: #fafafa;
+ border-width: 0;
+}
+
+div.warning {
+ background-color: #ffe4e4;
+ border: 1px solid #ff6666;
+}
+
+p.admonition-title {
+ display: inline;
+}
+
+p.admonition-title:after {
+ content: ":";
+}
+
+pre {
+ padding: 10px;
+ background-color: #fafafa;
+ color: #222222;
+ line-height: 1.5em;
+ font-size: 1.1em;
+ margin: 1.5em 0 1.5em 0;
+ -webkit-box-shadow: 0px 0px 4px #d8d8d8;
+ -moz-box-shadow: 0px 0px 4px #d8d8d8;
+ box-shadow: 0px 0px 4px #d8d8d8;
+}
+
+tt {
+ color: #222222;
+ padding: 1px 2px;
+ font-size: 1.2em;
+ font-family: monospace;
+}
+
+#table-of-contents ul {
+ padding-left: 2em;
+}
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/humanize-0.5.1/docs/_theme/nature/static/pygments.css
new/humanize-0.5.1/docs/_theme/nature/static/pygments.css
--- old/humanize-0.5.1/docs/_theme/nature/static/pygments.css 1970-01-01
01:00:00.000000000 +0100
+++ new/humanize-0.5.1/docs/_theme/nature/static/pygments.css 2014-11-13
17:41:57.000000000 +0100
@@ -0,0 +1,54 @@
+.c { color: #999988; font-style: italic } /* Comment */
+.k { font-weight: bold } /* Keyword */
+.o { font-weight: bold } /* Operator */
+.cm { color: #999988; font-style: italic } /* Comment.Multiline */
+.cp { color: #999999; font-weight: bold } /* Comment.preproc */
+.c1 { color: #999988; font-style: italic } /* Comment.Single */
+.gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
+.ge { font-style: italic } /* Generic.Emph */
+.gr { color: #aa0000 } /* Generic.Error */
+.gh { color: #999999 } /* Generic.Heading */
+.gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
+.go { color: #111 } /* Generic.Output */
+.gp { color: #555555 } /* Generic.Prompt */
+.gs { font-weight: bold } /* Generic.Strong */
+.gu { color: #aaaaaa } /* Generic.Subheading */
+.gt { color: #aa0000 } /* Generic.Traceback */
+.kc { font-weight: bold } /* Keyword.Constant */
+.kd { font-weight: bold } /* Keyword.Declaration */
+.kp { font-weight: bold } /* Keyword.Pseudo */
+.kr { font-weight: bold } /* Keyword.Reserved */
+.kt { color: #445588; font-weight: bold } /* Keyword.Type */
+.m { color: #009999 } /* Literal.Number */
+.s { color: #bb8844 } /* Literal.String */
+.na { color: #008080 } /* Name.Attribute */
+.nb { color: #999999 } /* Name.Builtin */
+.nc { color: #445588; font-weight: bold } /* Name.Class */
+.no { color: #ff99ff } /* Name.Constant */
+.ni { color: #800080 } /* Name.Entity */
+.ne { color: #990000; font-weight: bold } /* Name.Exception */
+.nf { color: #990000; font-weight: bold } /* Name.Function */
+.nn { color: #555555 } /* Name.Namespace */
+.nt { color: #000080 } /* Name.Tag */
+.nv { color: purple } /* Name.Variable */
+.ow { font-weight: bold } /* Operator.Word */
+.mf { color: #009999 } /* Literal.Number.Float */
+.mh { color: #009999 } /* Literal.Number.Hex */
+.mi { color: #009999 } /* Literal.Number.Integer */
+.mo { color: #009999 } /* Literal.Number.Oct */
+.sb { color: #bb8844 } /* Literal.String.Backtick */
+.sc { color: #bb8844 } /* Literal.String.Char */
+.sd { color: #bb8844 } /* Literal.String.Doc */
+.s2 { color: #bb8844 } /* Literal.String.Double */
+.se { color: #bb8844 } /* Literal.String.Escape */
+.sh { color: #bb8844 } /* Literal.String.Heredoc */
+.si { color: #bb8844 } /* Literal.String.Interpol */
+.sx { color: #bb8844 } /* Literal.String.Other */
+.sr { color: #808000 } /* Literal.String.Regex */
+.s1 { color: #bb8844 } /* Literal.String.Single */
+.ss { color: #bb8844 } /* Literal.String.Symbol */
+.bp { color: #999999 } /* Name.Builtin.Pseudo */
+.vc { color: #ff99ff } /* Name.Variable.Class */
+.vg { color: #ff99ff } /* Name.Variable.Global */
+.vi { color: #ff99ff } /* Name.Variable.Instance */
+.il { color: #009999 } /* Literal.Number.Integer.Long */
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanize-0.5.1/docs/_theme/nature/theme.conf
new/humanize-0.5.1/docs/_theme/nature/theme.conf
--- old/humanize-0.5.1/docs/_theme/nature/theme.conf 1970-01-01
01:00:00.000000000 +0100
+++ new/humanize-0.5.1/docs/_theme/nature/theme.conf 2014-11-13
17:41:57.000000000 +0100
@@ -0,0 +1,4 @@
+[theme]
+inherit = basic
+stylesheet = nature.css
+pygments_style = tango
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanize-0.5.1/docs/conf.py
new/humanize-0.5.1/docs/conf.py
--- old/humanize-0.5.1/docs/conf.py 1970-01-01 01:00:00.000000000 +0100
+++ new/humanize-0.5.1/docs/conf.py 2014-11-13 17:41:57.000000000 +0100
@@ -0,0 +1,184 @@
+# -*- coding: utf-8 -*-
+#
+# This file is execfile()d with the current directory set to its containing
dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+from datetime import datetime
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+projpath = os.path.abspath('..')
+sys.path.append(projpath)
+
+# -- General configuration
-----------------------------------------------------
+
+# Add any Sphinx extension module names here, as strings. They can be
extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = 'humanize'
+copyright = u'2010 Jason Moiron'
+
+# The short X.Y version.
+version = '0.1'
+# The full version, including alpha/beta/rc tags.
+version = None
+for line in open(os.path.join(projpath, 'setup.py'), 'r'):
+ if line.startswith('version'):
+ exec line
+if version is None:
+ version = '0.1'
+# The full version, including alpha/beta/rc tags.
+release = version
+
+print ("Building release: %s, version: %s" % (release, version))
+
+# List of documents that shouldn't be included in the build.
+#unused_docs = []
+
+# List of directories, relative to source directory, that shouldn't be searched
+# for source files.
+exclude_trees = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all
documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output
---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. Major themes that come with
+# Sphinx are currently 'default' and 'sphinxdoc'.
+#html_theme = 'default'
+html_theme = 'nature'
+html_theme_path = ['_theme']
+#html_theme_options = {}
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_use_modindex = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = ''
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'humanizedoc'
+
+
+# -- Options for LaTeX output
--------------------------------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass
[howto/manual]).
+latex_documents = [
+ ('index', 'humanize.tex', u'humanize Documentation',
+ u'Jason Moiron', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_use_modindex = True
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanize-0.5.1/docs/index.rst
new/humanize-0.5.1/docs/index.rst
--- old/humanize-0.5.1/docs/index.rst 1970-01-01 01:00:00.000000000 +0100
+++ new/humanize-0.5.1/docs/index.rst 2014-11-13 17:41:57.000000000 +0100
@@ -0,0 +1,20 @@
+.. humanize documentation master file, created by sphinx-quickstart.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+humanize
+-----------
+
+.. automodule:: humanize
+.. highlight:: sh
+
+You can install humanize with pip::
+
+ pip install humanize
+
+You can fork humanize `from its git repository
+<http://github.com/jmoiron/humanize/>`_::
+
+ git clone https://github.com/jmoiron/humanize.git
+
+.. highlight:: python
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanize-0.5.1/humanize.egg-info/PKG-INFO
new/humanize-0.5.1/humanize.egg-info/PKG-INFO
--- old/humanize-0.5.1/humanize.egg-info/PKG-INFO 2014-11-13
17:43:10.000000000 +0100
+++ new/humanize-0.5.1/humanize.egg-info/PKG-INFO 1970-01-01
01:00:00.000000000 +0100
@@ -1,117 +0,0 @@
-Metadata-Version: 1.1
-Name: humanize
-Version: 0.5.1
-Summary: python humanize utilities
-Home-page: http://github.com/jmoiron/humanize
-Author: Jason Moiron
-Author-email: [email protected]
-License: MIT
-Description: humanize
- --------
-
- .. image::
https://secure.travis-ci.org/jmoiron/humanize.png?branch=master
- :target: http://travis-ci.org/jmoiron/humanize
-
- This modest package contains various common humanization utilities,
like turning
- a number into a fuzzy human readable duration ('3 minutes ago') or
into a human
- readable size or throughput. It works with python 2.7 and 3.3 and is
localized
- to Russian, French, and Korean.
-
- usage
- -----
-
- Integer humanization::
-
- >>> import humanize
- >>> humanize.intcomma(12345)
- '12,345'
- >>> humanize.intword(123455913)
- '123.5 million'
- >>> humanize.intword(12345591313)
- '12.3 billion'
- >>> humanize.apnumber(4)
- 'four'
- >>> humanize.apnumber(41)
- '41'
-
- Date & time humanization::
-
- >>> import datetime
- >>> humanize.naturalday(datetime.datetime.now())
- 'today'
- >>> humanize.naturalday(datetime.datetime.now() -
datetime.timedelta(days=1))
- 'yesterday'
- >>> humanize.naturalday(datetime.date(2007, 6, 5))
- 'Jun 05'
- >>> humanize.naturaldate(datetime.date(2007, 6, 5))
- 'Jun 05 2007'
- >>> humanize.naturaltime(datetime.datetime.now() -
datetime.timedelta(seconds=1))
- 'a second ago'
- >>> humanize.naturaltime(datetime.datetime.now() -
datetime.timedelta(seconds=3600))
- 'an hour ago'
-
- Filesize humanization::
-
- >>> humanize.naturalsize(1000000)
- '1.0 MB'
- >>> humanize.naturalsize(1000000, binary=True)
- '976.6 KiB'
- >>> humanize.naturalsize(1000000, gnu=True)
- '976.6K'
-
-
- Human readable floating point numbers::
-
- >>> humanize.fractional(1/3)
- '1/3'
- >>> humanize.fractional(1.5)
- '1 1/2'
- >>> humanize.fractional(0.3)
- '3/10'
- >>> humanize.fractional(0.333)
- '1/3'
- >>> humanize.fractional(1)
- '1'
-
- Localization
- ------------
-
- How to change locale in runtime ::
-
- >>> print humanize.naturaltime(datetime.timedelta(seconds=3))
- 3 seconds ago
- >>> _t = humanize.i18n.activate('ru_RU')
- >>> print humanize.naturaltime(datetime.timedelta(seconds=3))
- 3 секунды назад
- >>> humanize.i18n.deactivate()
- >>> print humanize.naturaltime(datetime.timedelta(seconds=3))
- 3 seconds ago
-
- You can pass additional parameter *path* to :func:`activate` to
specify a path to
- search locales in. ::
-
- >>> humanize.i18n.activate('pt_BR')
- IOError: [Errno 2] No translation file found for domain: 'humanize'
- >>> humanize.i18n.activate('pt_BR',
path='path/to/my/portuguese/translation/')
- <gettext.GNUTranslations instance ...>
-
- How to add new phrases to existing locale files ::
-
- $ xgettext -o humanize.pot -k'_' -k'N_' -k'P_:1c,2' -l python
humanize/*.py # extract new phrases
- $ msgmerge -U humanize/locale/ru_RU/LC_MESSAGES/humanize.po
humanize.pot # add them to locale files
- $ msgfmt --check -o
humanize/locale/ru_RU/LC_MESSAGES/humanize{.po,.mo} # compile to binary .mo
-
- How to add new locale ::
-
- $ msginit -i humanize.pot -o humanize/locale/<locale
name>/LC_MESSAGES/humanize.po --locale <locale name>
-
- Where <locale name> is locale abbreviation, eg 'en_GB', 'pt_BR' or
just 'ru', 'fr' etc.
-
-Keywords: humanize time size
-Platform: UNKNOWN
-Classifier: Development Status :: 4 - Beta
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Operating System :: POSIX
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanize-0.5.1/humanize.egg-info/SOURCES.txt
new/humanize-0.5.1/humanize.egg-info/SOURCES.txt
--- old/humanize-0.5.1/humanize.egg-info/SOURCES.txt 2014-11-13
17:43:10.000000000 +0100
+++ new/humanize-0.5.1/humanize.egg-info/SOURCES.txt 1970-01-01
01:00:00.000000000 +0100
@@ -1,23 +0,0 @@
-LICENCE
-MANIFEST.in
-README.rst
-setup.cfg
-setup.py
-humanize/__init__.py
-humanize/compat.py
-humanize/filesize.py
-humanize/i18n.py
-humanize/number.py
-humanize/time.py
-humanize.egg-info/PKG-INFO
-humanize.egg-info/SOURCES.txt
-humanize.egg-info/dependency_links.txt
-humanize.egg-info/entry_points.txt
-humanize.egg-info/not-zip-safe
-humanize.egg-info/top_level.txt
-humanize/locale/fr_FR/LC_MESSAGES/humanize.mo
-humanize/locale/fr_FR/LC_MESSAGES/humanize.po
-humanize/locale/ko_KR/LC_MESSAGES/humanize.mo
-humanize/locale/ko_KR/LC_MESSAGES/humanize.po
-humanize/locale/ru_RU/LC_MESSAGES/humanize.mo
-humanize/locale/ru_RU/LC_MESSAGES/humanize.po
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/humanize-0.5.1/humanize.egg-info/dependency_links.txt
new/humanize-0.5.1/humanize.egg-info/dependency_links.txt
--- old/humanize-0.5.1/humanize.egg-info/dependency_links.txt 2014-11-13
17:43:10.000000000 +0100
+++ new/humanize-0.5.1/humanize.egg-info/dependency_links.txt 1970-01-01
01:00:00.000000000 +0100
@@ -1 +0,0 @@
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanize-0.5.1/humanize.egg-info/entry_points.txt
new/humanize-0.5.1/humanize.egg-info/entry_points.txt
--- old/humanize-0.5.1/humanize.egg-info/entry_points.txt 2014-11-13
17:43:10.000000000 +0100
+++ new/humanize-0.5.1/humanize.egg-info/entry_points.txt 1970-01-01
01:00:00.000000000 +0100
@@ -1,3 +0,0 @@
-
- # -*- Entry points: -*-
-
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanize-0.5.1/humanize.egg-info/not-zip-safe
new/humanize-0.5.1/humanize.egg-info/not-zip-safe
--- old/humanize-0.5.1/humanize.egg-info/not-zip-safe 2013-05-17
00:33:56.000000000 +0200
+++ new/humanize-0.5.1/humanize.egg-info/not-zip-safe 1970-01-01
01:00:00.000000000 +0100
@@ -1 +0,0 @@
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanize-0.5.1/humanize.egg-info/top_level.txt
new/humanize-0.5.1/humanize.egg-info/top_level.txt
--- old/humanize-0.5.1/humanize.egg-info/top_level.txt 2014-11-13
17:43:10.000000000 +0100
+++ new/humanize-0.5.1/humanize.egg-info/top_level.txt 1970-01-01
01:00:00.000000000 +0100
@@ -1 +0,0 @@
-humanize
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanize-0.5.1/setup.cfg new/humanize-0.5.1/setup.cfg
--- old/humanize-0.5.1/setup.cfg 2014-11-13 17:43:10.000000000 +0100
+++ new/humanize-0.5.1/setup.cfg 2014-11-13 17:41:57.000000000 +0100
@@ -1,8 +1,3 @@
[upload_docs]
upload-dir = docs/_build/html
-[egg_info]
-tag_build =
-tag_date = 0
-tag_svn_revision = 0
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanize-0.5.1/tests/__init__.py
new/humanize-0.5.1/tests/__init__.py
--- old/humanize-0.5.1/tests/__init__.py 1970-01-01 01:00:00.000000000
+0100
+++ new/humanize-0.5.1/tests/__init__.py 2014-11-13 17:41:57.000000000
+0100
@@ -0,0 +1,3 @@
+from .time import *
+from .number import *
+from .filesize import *
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanize-0.5.1/tests/base.py
new/humanize-0.5.1/tests/base.py
--- old/humanize-0.5.1/tests/base.py 1970-01-01 01:00:00.000000000 +0100
+++ new/humanize-0.5.1/tests/base.py 2014-11-13 17:41:57.000000000 +0100
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""Tests base classes."""
+
+from unittest import TestCase
+
+class HumanizeTestCase(TestCase):
+
+ def assertManyResults(self, function, args, results):
+ """Goes through a list of arguments and makes sure that function called
+ upon them lists a similarly ordered list of results. If more than one
+ argument is required, each position in args may be a tuple."""
+ for arg, result in zip(args, results):
+ if isinstance(arg, tuple):
+ self.assertEqual(function(*arg), result)
+ else:
+ self.assertEqual(function(arg), result)
+
+ def assertEqualDatetime(self, dt1, dt2):
+ self.assertEqual((dt1 - dt2).seconds, 0)
+
+ def assertEqualTimedelta(self, td1, td2):
+ self.assertEqual(td1.days, td2.days)
+ self.assertEqual(td1.seconds, td2.seconds)
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanize-0.5.1/tests/filesize.py
new/humanize-0.5.1/tests/filesize.py
--- old/humanize-0.5.1/tests/filesize.py 1970-01-01 01:00:00.000000000
+0100
+++ new/humanize-0.5.1/tests/filesize.py 2014-11-13 17:41:57.000000000
+0100
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""Tests for filesize humanizing."""
+
+from humanize import filesize
+from .base import HumanizeTestCase
+
+class FilesizeTestCase(HumanizeTestCase):
+ def test_naturalsize(self):
+ tests = (300, 3000, 3000000, 3000000000, 3000000000000, (300, True),
+ (3000, True), (3000000, True), (300, False, True), (3000, False,
True),
+ (3000000, False, True), (1024, False, True), (10**26 * 30, False,
True),
+ (10**26 * 30, True), 10**26 * 30,
+ (3141592, False, False, '%.2f'), (3000, False, True, '%.3f'),
+ (3000000000, False, True, '%.0f'), (10**26 * 30, True, False,
'%.3f'),)
+ results = ('300 Bytes', '3.0 kB', '3.0 MB', '3.0 GB', '3.0 TB',
+ '300 Bytes', '2.9 KiB', '2.9 MiB', '300B', '2.9K', '2.9M', '1.0K',
'2481.5Y',
+ '2481.5 YiB', '3000.0 YB',
+ '3.14 MB', '2.930K', '3G', '2481.542 YiB')
+ self.assertManyResults(filesize.naturalsize, tests, results)
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanize-0.5.1/tests/number.py
new/humanize-0.5.1/tests/number.py
--- old/humanize-0.5.1/tests/number.py 1970-01-01 01:00:00.000000000 +0100
+++ new/humanize-0.5.1/tests/number.py 2014-11-13 17:41:57.000000000 +0100
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""Number tests."""
+
+from humanize import number
+from .base import HumanizeTestCase
+
+class NumberTestCase(HumanizeTestCase):
+
+ def test_ordinal(self):
+ test_list = ('1', '2', '3', '4', '11', '12', '13', '101', '102', '103',
+ '111', 'something else', None)
+ result_list = ('1st', '2nd', '3rd', '4th', '11th', '12th', '13th',
+ '101st', '102nd', '103rd', '111th', 'something else', None)
+ self.assertManyResults(number.ordinal, test_list, result_list)
+
+ def test_intcomma(self):
+ test_list = (100, 1000, 10123, 10311, 1000000, 1234567.25, '100',
+ '1000', '10123', '10311', '1000000', '1234567.1234567', None)
+ result_list = ('100', '1,000', '10,123', '10,311', '1,000,000',
+ '1,234,567.25', '100', '1,000', '10,123', '10,311', '1,000,000',
+ '1,234,567.1234567', None)
+ self.assertManyResults(number.intcomma, test_list, result_list)
+
+ def test_intword(self):
+ # make sure that powers & human_powers have the same number of items
+ self.assertEqual(len(number.powers), len(number.human_powers))
+ # test the result of intword
+ test_list = ('100', '1000000', '1200000', '1290000', '1000000000',
+ '2000000000', '6000000000000', '1300000000000000',
+ '3500000000000000000000', '8100000000000000000000000000000000',
+ None, ('1230000', '%0.2f'), 10**101)
+ result_list = ('100', '1.0 million', '1.2 million', '1.3 million',
+ '1.0 billion', '2.0 billion', '6.0 trillion', '1.3 quadrillion',
+ '3.5 sextillion', '8.1 decillion', None, '1.23 million',
+ '1'+'0'*101)
+ self.assertManyResults(number.intword, test_list, result_list)
+
+ def test_apnumber(self):
+ test_list = (1, 2, 4, 5, 9, 10, '7', None)
+ result_list = ('one', 'two', 'four', 'five', 'nine', '10', 'seven',
None)
+ self.assertManyResults(number.apnumber, test_list, result_list)
+
+ def test_fractional(self):
+ test_list = (1, 2.0, (4.0/3.0), (5.0/6.0), '7', '8.9', 'ten', None)
+ result_list = ('1', '2', '1 1/3', '5/6', '7', '8 9/10', 'ten', None)
+ self.assertManyResults(number.fractional, test_list, result_list)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanize-0.5.1/tests/time.py
new/humanize-0.5.1/tests/time.py
--- old/humanize-0.5.1/tests/time.py 1970-01-01 01:00:00.000000000 +0100
+++ new/humanize-0.5.1/tests/time.py 2014-11-13 17:41:57.000000000 +0100
@@ -0,0 +1,288 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""Tests for time humanizing."""
+
+from mock import patch
+
+from humanize import time
+from datetime import date, datetime, timedelta
+from .base import HumanizeTestCase
+
+today = date.today()
+one_day = timedelta(days=1)
+
+class fakedate(object):
+ def __init__(self, year, month, day):
+ self.year, self.month, self.day = year, month, day
+
+class TimeUtilitiesTestCase(HumanizeTestCase):
+ """These are not considered "public" interfaces, but require tests
anyway."""
+ def test_date_and_delta(self):
+ now = datetime.now()
+ td = timedelta
+ int_tests = (3, 29, 86399, 86400, 86401*30)
+ date_tests = [now - td(seconds=x) for x in int_tests]
+ td_tests = [td(seconds=x) for x in int_tests]
+ results = [(now - td(seconds=x), td(seconds=x)) for x in int_tests]
+ for t in (int_tests, date_tests, td_tests):
+ for arg, result in zip(t, results):
+ dt, d = time.date_and_delta(arg)
+ self.assertEqualDatetime(dt, result[0])
+ self.assertEqualTimedelta(d, result[1])
+ self.assertEqual(time.date_and_delta("NaN"), (None, "NaN"))
+
+class TimeTestCase(HumanizeTestCase):
+ """Tests for the public interface of humanize.time"""
+
+ def test_naturaldelta_nomonths(self):
+ now = datetime.now()
+ test_list = [
+ timedelta(days=7),
+ timedelta(days=31),
+ timedelta(days=230),
+ timedelta(days=400),
+ ]
+ result_list = [
+ '7 days',
+ '31 days',
+ '230 days',
+ '1 year, 35 days',
+ ]
+ with patch('humanize.time._now') as mocked:
+ mocked.return_value = now
+ nd_nomonths = lambda d: time.naturaldelta(d, months=False)
+ self.assertManyResults(nd_nomonths, test_list, result_list)
+
+ def test_naturaldelta(self):
+ now = datetime.now()
+ test_list = [
+ 0,
+ 1,
+ 30,
+ timedelta(minutes=1, seconds=30),
+ timedelta(minutes=2),
+ timedelta(hours=1, minutes=30, seconds=30),
+ timedelta(hours=23, minutes=50, seconds=50),
+ timedelta(days=1),
+ timedelta(days=500),
+ timedelta(days=365*2 + 35),
+ timedelta(seconds=1),
+ timedelta(seconds=30),
+ timedelta(minutes=1, seconds=30),
+ timedelta(minutes=2),
+ timedelta(hours=1, minutes=30, seconds=30),
+ timedelta(hours=23, minutes=50, seconds=50),
+ timedelta(days=1),
+ timedelta(days=500),
+ timedelta(days=365*2 + 35),
+ # regression tests for bugs in post-release humanize
+ timedelta(days=10000),
+ timedelta(days=365+35),
+ 30,
+ timedelta(days=365*2 + 65),
+ timedelta(days=365 + 4),
+ timedelta(days=35),
+ timedelta(days=65),
+ timedelta(days=9),
+ timedelta(days=365),
+ "NaN",
+ ]
+ result_list = [
+ 'a moment',
+ 'a second',
+ '30 seconds',
+ 'a minute',
+ '2 minutes',
+ 'an hour',
+ '23 hours',
+ 'a day',
+ '1 year, 4 months',
+ '2 years',
+ 'a second',
+ '30 seconds',
+ 'a minute',
+ '2 minutes',
+ 'an hour',
+ '23 hours',
+ 'a day',
+ '1 year, 4 months',
+ '2 years',
+ '27 years',
+ '1 year, 1 month',
+ '30 seconds',
+ '2 years',
+ '1 year, 4 days',
+ 'a month',
+ '2 months',
+ '9 days',
+ 'a year',
+ "NaN",
+ ]
+ with patch('humanize.time._now') as mocked:
+ mocked.return_value = now
+ self.assertManyResults(time.naturaldelta, test_list, result_list)
+
+ def test_naturaltime(self):
+ now = datetime.now()
+ test_list = [
+ now,
+ now - timedelta(seconds=1),
+ now - timedelta(seconds=30),
+ now - timedelta(minutes=1, seconds=30),
+ now - timedelta(minutes=2),
+ now - timedelta(hours=1, minutes=30, seconds=30),
+ now - timedelta(hours=23, minutes=50, seconds=50),
+ now - timedelta(days=1),
+ now - timedelta(days=500),
+ now - timedelta(days=365*2 + 35),
+ now + timedelta(seconds=1),
+ now + timedelta(seconds=30),
+ now + timedelta(minutes=1, seconds=30),
+ now + timedelta(minutes=2),
+ now + timedelta(hours=1, minutes=30, seconds=30),
+ now + timedelta(hours=23, minutes=50, seconds=50),
+ now + timedelta(days=1),
+ now + timedelta(days=500),
+ now + timedelta(days=365*2 + 35),
+ # regression tests for bugs in post-release humanize
+ now + timedelta(days=10000),
+ now - timedelta(days=365+35),
+ 30,
+ now - timedelta(days=365*2 + 65),
+ now - timedelta(days=365 + 4),
+ "NaN",
+ ]
+ result_list = [
+ 'now',
+ 'a second ago',
+ '30 seconds ago',
+ 'a minute ago',
+ '2 minutes ago',
+ 'an hour ago',
+ '23 hours ago',
+ 'a day ago',
+ '1 year, 4 months ago',
+ '2 years ago',
+ 'a second from now',
+ '30 seconds from now',
+ 'a minute from now',
+ '2 minutes from now',
+ 'an hour from now',
+ '23 hours from now',
+ 'a day from now',
+ '1 year, 4 months from now',
+ '2 years from now',
+ '27 years from now',
+ '1 year, 1 month ago',
+ '30 seconds ago',
+ '2 years ago',
+ '1 year, 4 days ago',
+ "NaN",
+ ]
+ with patch('humanize.time._now') as mocked:
+ mocked.return_value = now
+ self.assertManyResults(time.naturaltime, test_list, result_list)
+
+ def test_naturaltime_nomonths(self):
+ now = datetime.now()
+ test_list = [
+ now,
+ now - timedelta(seconds=1),
+ now - timedelta(seconds=30),
+ now - timedelta(minutes=1, seconds=30),
+ now - timedelta(minutes=2),
+ now - timedelta(hours=1, minutes=30, seconds=30),
+ now - timedelta(hours=23, minutes=50, seconds=50),
+ now - timedelta(days=1),
+ now - timedelta(days=17),
+ now - timedelta(days=47),
+ now - timedelta(days=500),
+ now - timedelta(days=365*2 + 35),
+ now + timedelta(seconds=1),
+ now + timedelta(seconds=30),
+ now + timedelta(minutes=1, seconds=30),
+ now + timedelta(minutes=2),
+ now + timedelta(hours=1, minutes=30, seconds=30),
+ now + timedelta(hours=23, minutes=50, seconds=50),
+ now + timedelta(days=1),
+ now + timedelta(days=500),
+ now + timedelta(days=365*2 + 35),
+ # regression tests for bugs in post-release humanize
+ now + timedelta(days=10000),
+ now - timedelta(days=365+35),
+ 30,
+ now - timedelta(days=365*2 + 65),
+ now - timedelta(days=365 + 4),
+ "NaN",
+ ]
+ result_list = [
+ 'now',
+ 'a second ago',
+ '30 seconds ago',
+ 'a minute ago',
+ '2 minutes ago',
+ 'an hour ago',
+ '23 hours ago',
+ 'a day ago',
+ '17 days ago',
+ '47 days ago',
+ '1 year, 135 days ago',
+ '2 years ago',
+ 'a second from now',
+ '30 seconds from now',
+ 'a minute from now',
+ '2 minutes from now',
+ 'an hour from now',
+ '23 hours from now',
+ 'a day from now',
+ '1 year, 135 days from now',
+ '2 years from now',
+ '27 years from now',
+ '1 year, 35 days ago',
+ '30 seconds ago',
+ '2 years ago',
+ '1 year, 4 days ago',
+ "NaN",
+ ]
+ with patch('humanize.time._now') as mocked:
+ mocked.return_value = now
+ nt_nomonths = lambda d: time.naturaltime(d, months=False)
+ self.assertManyResults(nt_nomonths, test_list, result_list)
+
+ def test_naturalday(self):
+ tomorrow = today + one_day
+ yesterday = today - one_day
+ if today.month != 3:
+ someday = date(today.year, 3, 5)
+ someday_result = 'Mar 05'
+ else:
+ someday = date(today.year, 9, 5)
+ someday_result = 'Sep 05'
+ valerrtest = fakedate(290149024, 2, 2)
+ overflowtest = fakedate(120390192341, 2, 2)
+ test_list = (today, tomorrow, yesterday, someday, '02/26/1984',
+ (date(1982, 6, 27), '%Y.%M.%D'), None, "Not a date at all.",
+ valerrtest, overflowtest
+ )
+ result_list = ('today', 'tomorrow', 'yesterday', someday_result,
'02/26/1984',
+ date(1982, 6, 27).strftime('%Y.%M.%D'), None, "Not a date at all.",
+ valerrtest, overflowtest
+ )
+ self.assertManyResults(time.naturalday, test_list, result_list)
+
+ def test_naturaldate(self):
+ tomorrow = today + one_day
+ yesterday = today - one_day
+
+ if today.month != 3:
+ someday = date(today.year, 3, 5)
+ someday_result = 'Mar 05'
+ else:
+ someday = date(today.year, 9, 5)
+ someday_result = 'Sep 05'
+
+ test_list = (today, tomorrow, yesterday, someday, date(1982, 6, 27))
+ result_list = ('today', 'tomorrow', 'yesterday', someday_result, 'Jun
27 1982')
+ self.assertManyResults(time.naturaldate, test_list, result_list)
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanize-0.5.1/tox.ini new/humanize-0.5.1/tox.ini
--- old/humanize-0.5.1/tox.ini 1970-01-01 01:00:00.000000000 +0100
+++ new/humanize-0.5.1/tox.ini 2014-11-13 17:41:57.000000000 +0100
@@ -0,0 +1,7 @@
+[tox]
+downloadcache = {toxworkdir}/cache/
+envlist = py27,py33,pypy
+
+[testenv]
+commands = python setup.py test
+