Hello community,

here is the log from the commit of package python-jdcal for openSUSE:Factory 
checked in at 2015-12-23 08:49:29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-jdcal (Old)
 and      /work/SRC/openSUSE:Factory/.python-jdcal.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-jdcal"

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-jdcal/python-jdcal.changes        
2015-05-29 10:39:37.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.python-jdcal.new/python-jdcal.changes   
2015-12-23 08:49:31.000000000 +0100
@@ -1,0 +2,5 @@
+Thu Dec 10 16:24:48 UTC 2015 - br...@ioda-net.ch
+
+- Update to upstream 1.2 version 
+
+-------------------------------------------------------------------

Old:
----
  jdcal-1.0.tar.gz

New:
----
  jdcal-1.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-jdcal.spec ++++++
--- /var/tmp/diff_new_pack.JrB51M/_old  2015-12-23 08:49:31.000000000 +0100
+++ /var/tmp/diff_new_pack.JrB51M/_new  2015-12-23 08:49:31.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-jdcal
 #
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 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
@@ -16,14 +16,17 @@
 #
 
 
-Name:           python-jdcal
-Version:        1.0
+#
+%define _pyname jdcal
+
+Name:           python-%{_pyname}
+Version:        1.2
 Release:        0
 Summary:        Julian dates from proleptic Gregorian and Julian calendars
 License:        BSD-2-Clause
 Group:          Development/Languages/Python
-Url:            http://github.com/phn/jdcal
-Source:         
https://pypi.python.org/packages/source/j/jdcal/jdcal-%{version}.tar.gz
+Url:            http://github.com/phn/%{_pyname}
+Source:         
https://pypi.python.org/packages/source/j/%{_pyname}/%{_pyname}-%{version}.tar.gz
 BuildRequires:  python-devel
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 %if 0%{?suse_version} && 0%{?suse_version} <= 1110
@@ -42,7 +45,7 @@
 defined.
 
 %prep
-%setup -q -n jdcal-%{version}
+%setup -q -n %{_pyname}-%{version}
 
 %build
 python setup.py build

++++++ jdcal-1.0.tar.gz -> jdcal-1.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jdcal-1.0/LICENSE.txt new/jdcal-1.2/LICENSE.txt
--- old/jdcal-1.0/LICENSE.txt   1970-01-01 01:00:00.000000000 +0100
+++ new/jdcal-1.2/LICENSE.txt   2015-11-09 08:16:40.000000000 +0100
@@ -0,0 +1,10 @@
+Copyright (c) 2011, Prasanth Nair
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without 
modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this 
list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice, 
this list of conditions and the following disclaimer in the documentation 
and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jdcal-1.0/PKG-INFO new/jdcal-1.2/PKG-INFO
--- old/jdcal-1.0/PKG-INFO      2011-10-08 09:01:45.000000000 +0200
+++ new/jdcal-1.2/PKG-INFO      2015-11-11 04:07:34.000000000 +0100
@@ -1,6 +1,6 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
 Name: jdcal
-Version: 1.0
+Version: 1.2
 Summary: Julian dates from proleptic Gregorian and Julian calendars.
 Home-page: http://github.com/phn/jdcal
 Author: Prasanth Nair
@@ -15,6 +15,10 @@
         .. _pip: http://pypi.python.org/pypi/pip
         .. _easy_install: packages.python.org/distribute/easy_install.html
         
+        .. image:: https://travis-ci.org/phn/jdcal.svg?branch=master
+            :target: https://travis-ci.org/phn/jdcal
+        
+        
         This module contains functions for converting between Julian dates and
         calendar dates.
         
@@ -53,8 +57,11 @@
         Some examples are given below. For more information see
         http://oneau.wordpress.com/jdcal/.
         
-        Gregorian calendar::
+        Gregorian calendar:
         
+        .. code-block:: python
+        
+            >>> from jdcal import gcal2jd, jd2gcal
             >>> gcal2jd(2000,1,1)
             (2400000.5, 51544.0)
             >>> 2400000.5 + 51544.0 + 0.5
@@ -87,22 +94,30 @@
             >>> jd2gcal(2400000.5, 51544.75)
             (2000, 1, 1, 0.75)
         
-        Julian calendar::
+        Julian calendar:
+        
+        .. code-block:: python
         
             >>> jd2jcal(*jcal2jd(2000, 1, 1))
             (2000, 1, 1, 0.0)
             >>> jd2jcal(*jcal2jd(-4000, 10, 11))
             (-4000, 10, 11, 0.0)
         
-        Gregorian leap year::
+        Gregorian leap year:
         
+        .. code-block:: python
+        
+            >>> from jdcal import is_leap
             >>> is_leap(2000)
             True
             >>> is_leap(2100)
             False
         
-        JD for zero point of MJD, and MJD for JD2000.0::
+        JD for zero point of MJD, and MJD for JD2000.0:
+        
+        .. code-block:: python
         
+            >>> from jdcal import MJD_0, MJD_JD2000
             >>> print MJD_0
             2400000.5
             >>> print MJD_JD2000
@@ -123,12 +138,13 @@
           $ easy_install jdcal
         
         
+        Tests are in ``test_jdcal.py``.
+        
         Credits
         --------
         
         1. A good amount of the code is based on the excellent `TPM`_ C library
-           by `Jeffrey W. Percival`_. A Python interface to this C library is
-           available at http://github.com/phn/pytpm.
+           by `Jeffrey W. Percival`_.
         2. The inspiration to split Julian dates into two numbers came from the
            `IAU SOFA`_ C library. No code or algorithm from the SOFA library is
            used in `jdcal`.
@@ -136,8 +152,7 @@
         License
         -------
         
-        Released under BSD; see
-        http://www.opensource.org/licenses/bsd-license.php.
+        Released under BSD; see LICENSE.txt.
         
         For comments and suggestions, email to user `prasanthhn` in the 
`gmail.com`
         domain.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jdcal-1.0/README.rst new/jdcal-1.2/README.rst
--- old/jdcal-1.0/README.rst    2011-10-08 08:58:12.000000000 +0200
+++ new/jdcal-1.2/README.rst    2015-11-11 03:55:20.000000000 +0100
@@ -7,6 +7,10 @@
 .. _pip: http://pypi.python.org/pypi/pip
 .. _easy_install: packages.python.org/distribute/easy_install.html
 
+.. image:: https://travis-ci.org/phn/jdcal.svg?branch=master
+    :target: https://travis-ci.org/phn/jdcal
+
+
 This module contains functions for converting between Julian dates and
 calendar dates.
 
@@ -45,8 +49,11 @@
 Some examples are given below. For more information see
 http://oneau.wordpress.com/jdcal/.
 
-Gregorian calendar::
+Gregorian calendar:
 
+.. code-block:: python
+
+    >>> from jdcal import gcal2jd, jd2gcal
     >>> gcal2jd(2000,1,1)
     (2400000.5, 51544.0)
     >>> 2400000.5 + 51544.0 + 0.5
@@ -79,22 +86,30 @@
     >>> jd2gcal(2400000.5, 51544.75)
     (2000, 1, 1, 0.75)
 
-Julian calendar::
+Julian calendar:
+
+.. code-block:: python
 
     >>> jd2jcal(*jcal2jd(2000, 1, 1))
     (2000, 1, 1, 0.0)
     >>> jd2jcal(*jcal2jd(-4000, 10, 11))
     (-4000, 10, 11, 0.0)
 
-Gregorian leap year::
+Gregorian leap year:
 
+.. code-block:: python
+
+    >>> from jdcal import is_leap
     >>> is_leap(2000)
     True
     >>> is_leap(2100)
     False
 
-JD for zero point of MJD, and MJD for JD2000.0::
+JD for zero point of MJD, and MJD for JD2000.0:
+
+.. code-block:: python
 
+    >>> from jdcal import MJD_0, MJD_JD2000
     >>> print MJD_0
     2400000.5
     >>> print MJD_JD2000
@@ -115,12 +130,13 @@
   $ easy_install jdcal
 
 
+Tests are in ``test_jdcal.py``.
+
 Credits
 --------
 
 1. A good amount of the code is based on the excellent `TPM`_ C library
-   by `Jeffrey W. Percival`_. A Python interface to this C library is
-   available at http://github.com/phn/pytpm.
+   by `Jeffrey W. Percival`_.
 2. The inspiration to split Julian dates into two numbers came from the
    `IAU SOFA`_ C library. No code or algorithm from the SOFA library is
    used in `jdcal`.
@@ -128,8 +144,7 @@
 License
 -------
 
-Released under BSD; see
-http://www.opensource.org/licenses/bsd-license.php.
+Released under BSD; see LICENSE.txt.
 
 For comments and suggestions, email to user `prasanthhn` in the `gmail.com`
 domain.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jdcal-1.0/jdcal.py new/jdcal-1.2/jdcal.py
--- old/jdcal-1.0/jdcal.py      2011-10-08 07:51:56.000000000 +0200
+++ new/jdcal-1.2/jdcal.py      2015-11-11 04:03:41.000000000 +0100
@@ -42,7 +42,7 @@
 from __future__ import print_function
 import math
 
-__version__ = "1.0"
+__version__ = "1.2"
 
 MJD_0 = 2400000.5
 MJD_JD2000 = 51544.5
@@ -443,83 +443,3 @@
     year = (4 * k) + n + i - 4716.0
 
     return int(year), int(month), int(day), f
-
-
-# Some tests.
-def _test_gcal2jd_with_sla_cldj():
-    """Compare gcal2jd with slalib.sla_cldj."""
-    import random
-    try:
-        from pyslalib import slalib
-    except ImportError:
-        print("SLALIB (PySLALIB not available).")
-        return 1
-    n = 1000
-    mday = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
-
-    # sla_cldj needs year > -4699 i.e., 4700 BC.
-    year = [random.randint(-4699, 2200) for i in range(n)]
-    month = [random.randint(1, 12) for i in range(n)]
-    day = [random.randint(1, 31) for i in range(n)]
-    for i in range(n):
-        x = 0
-        if is_leap(year[i]) and month[i] == 2:
-            x = 1
-        if day[i] > mday[month[i]] + x:
-            day[i] = mday[month[i]]
-
-    jd_jdc = [gcal2jd(y, m, d)[1]
-              for y, m, d in zip(year, month, day)]
-    jd_sla = [slalib.sla_cldj(y, m, d)[0]
-              for y, m, d in zip(year, month, day)]
-    diff = [abs(i - j) for i, j in zip(jd_sla, jd_jdc)]
-    assert max(diff) <= 1e-8
-    assert min(diff) <= 1e-8
-
-
-def _test_jd2gcal():
-    """Check jd2gcal as reverse of gcal2jd."""
-    import random
-    n = 1000
-    mday = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
-
-    year = [random.randint(-4699, 2200) for i in range(n)]
-    month = [random.randint(1, 12) for i in range(n)]
-    day = [random.randint(1, 31) for i in range(n)]
-    for i in range(n):
-        x = 0
-        if is_leap(year[i]) and month[i] == 2:
-            x = 1
-        if day[i] > mday[month[i]] + x:
-            day[i] = mday[month[i]]
-
-    jd = [gcal2jd(y, m, d)[1]
-          for y, m, d in zip(year, month, day)]
-
-    x = [jd2gcal(MJD_0, i) for i in jd]
-
-    for i in range(n):
-        assert x[i][0] == year[i]
-        assert x[i][1] == month[i]
-        assert x[i][2] == day[i]
-        assert x[i][3] <= 1e-15
-
-
-def _test_jd2jcal():
-    """Check jd2jcal as reverse of jcal2jd."""
-    import random
-    n = 1000
-    year = [random.randint(-4699, 2200) for i in range(n)]
-    month = [random.randint(1, 12) for i in range(n)]
-    day = [random.randint(1, 28) for i in range(n)]
-
-    jd = [jcal2jd(y, m, d)[1]
-          for y, m, d in zip(year, month, day)]
-
-    x = [jd2gcal(MJD_0, i) for i in jd]
-
-    for i in range(n):
-        assert x[i][0] == year[i]
-        assert x[i][1] == month[i]
-        assert x[i][2] == day[i]
-        assert x[i][3] <= 1e-15
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jdcal-1.0/setup.py new/jdcal-1.2/setup.py
--- old/jdcal-1.0/setup.py      2011-10-08 08:44:40.000000000 +0200
+++ new/jdcal-1.2/setup.py      2015-11-09 08:37:43.000000000 +0100
@@ -24,6 +24,6 @@
         'License :: OSI Approved :: BSD License',
         'Topic :: Scientific/Engineering :: Astronomy',
         'Programming Language :: Python',
-        ],
+    ],
     py_modules=["jdcal"]
-    )
+)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jdcal-1.0/test_jdcal.py new/jdcal-1.2/test_jdcal.py
--- old/jdcal-1.0/test_jdcal.py 1970-01-01 01:00:00.000000000 +0100
+++ new/jdcal-1.2/test_jdcal.py 2015-11-10 13:20:58.000000000 +0100
@@ -0,0 +1,140 @@
+"""Tests for jdcal.py"""
+import pytest
+
+from jdcal import (
+    fpart, ipart, is_leap, gcal2jd, jd2gcal, jcal2jd, jd2jcal, MJD_0)
+
+
+def test_fpart():
+    assert round(fpart(20.345), 12) == 0.345
+    assert round(fpart(-20.345), 12) == -0.345
+    assert round(fpart(0.12345), 12) == 0.12345
+    assert round(fpart(-0.6789), 12) == -0.6789
+
+
+def test_ipart():
+    assert round(ipart(20.345), 12) == 20.0
+    assert round(ipart(-20.345), 12) == -20.0
+    assert round(ipart(0.12345), 12) == -0.0
+    assert round(ipart(-0.6789), 12) == -0.0
+
+
+def test_is_leap():
+    assert is_leap(2000)
+    assert not is_leap(2001)
+    assert is_leap(2004)
+    assert not is_leap(1000)
+    assert not is_leap(1998)
+    assert is_leap(1992)
+
+
+def test_gcal2jd_simple():
+    r = gcal2jd(2000, 1, 1)
+    assert round(r[0], 12) == 2400000.5
+    assert round(r[1], 12) == 51544.0
+
+
+def test_gcal2jd_negative_numbers_and_zero():
+    assert gcal2jd(2000, -2, -4) == gcal2jd(1999, 9, 26)
+    assert gcal2jd(2000, 2, -1) == gcal2jd(2000, 1, 30)
+    assert gcal2jd(2000, 3, -1) == gcal2jd(2000, 2, 28)
+
+    assert gcal2jd(2000, 3, 0) == gcal2jd(2000, 2, 29)
+    assert gcal2jd(2001, 3, 0) == gcal2jd(2001, 2, 28)
+
+
+def test_gcal2jd_next_month():
+    assert gcal2jd(2000, 2, 30) == gcal2jd(2000, 3, 1)
+    assert gcal2jd(2001, 2, 30) == gcal2jd(2001, 3, 2)
+    assert gcal2jd(2000, 12, 32) == gcal2jd(2001, 1, 1)
+
+
+def test_gcal2jd_is_for_mid_night_of_given_day():
+    # input values are truncated to integers. So this is trivial.
+    assert gcal2jd(1996, 4, 3) == gcal2jd(1996, 4, 3.5)
+    assert gcal2jd(2000, 10, 25) == gcal2jd(2000, 10, 25.9)
+
+
+def test_jd2gcal():
+    assert jd2gcal(*gcal2jd(2000, 1, 1)) == (2000, 1, 1, 0.0)
+    assert jd2gcal(*gcal2jd(1950, 1, 1)) == (1950, 1, 1, 0.0)
+    assert jd2gcal(*gcal2jd(1999, 10, 12)) == (1999, 10, 12, 0.0)
+    assert jd2gcal(*gcal2jd(2000, 2, 30)) == (2000, 3, 1, 0.0)
+    assert jd2gcal(*gcal2jd(2000, -2, -4)) == (1999, 9, 26, 0.0)
+
+
+def test_jd2gcal_fractional_day_part():
+    r = jd2gcal(2400000.5, 51544.0 + 0.5)
+    assert round(r[-1], 12) == 0.5
+
+    r = jd2gcal(2400000.5, 51544.0 + 0.245)
+    assert round(r[-1], 10) == round(0.245, 10)
+
+    r = jd2gcal(2400000.5, 51544.0 + 0.75)
+    assert round(r[-1], 12) == 0.75
+
+
+def test_jcal2jd_and_back_through_jd2jcal():
+    """Check round trip from jcal2jd to jd2jcal."""
+    import random
+    n = 1000
+    year = [random.randint(-4699, 2200) for i in range(n)]
+    month = [random.randint(1, 12) for i in range(n)]
+    day = [random.randint(1, 28) for i in range(n)]
+
+    jd = [jcal2jd(y, m, d)[1]
+          for y, m, d in zip(year, month, day)]
+
+    x = [jd2jcal(MJD_0, i) for i in jd]
+
+    for i in range(n):
+        assert x[i][0] == year[i]
+        assert x[i][1] == month[i]
+        assert x[i][2] == day[i]
+        assert x[i][3] <= 1e-15
+
+
+def pyslalib_un_available():
+    x = True
+    try:
+        from pyslalib import slalib
+        slalib.sla_cldj
+        x = False
+    except:
+        pass
+    return x
+
+
+@pytest.mark.skipif(pyslalib_un_available(), reason="pyslalib not available")
+def test_gcal2jd_with_sla_cldj():
+    """Compare gcal2jd with slalib.sla_cldj."""
+    import random
+    try:
+        from pyslalib import slalib
+    except ImportError:
+        print("SLALIB (PySLALIB not available).")
+        return 1
+    n = 1000
+    mday = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
+
+    # sla_cldj needs year > -4699 i.e., 4700 BC.
+    year = [random.randint(-4699, 2200) for i in range(n)]
+    month = [random.randint(1, 12) for i in range(n)]
+    day = [random.randint(1, 31) for i in range(n)]
+    for i in range(n):
+        x = 0
+        if is_leap(year[i]) and month[i] == 2:
+            x = 1
+        if day[i] > mday[month[i]] + x:
+            day[i] = mday[month[i]]
+
+    jd_jdc = [gcal2jd(y, m, d)[1]
+              for y, m, d in zip(year, month, day)]
+    jd_sla = [slalib.sla_cldj(y, m, d)[0]
+              for y, m, d in zip(year, month, day)]
+    diff = [abs(i - j) for i, j in zip(jd_sla, jd_jdc)]
+    assert max(diff) <= 1e-8
+    assert min(diff) <= 1e-8
+
+if __name__ == '__main__':
+    pytest.main()


Reply via email to