Просмотр исходного кода

datetimeex.Period tests: remove param 'isoformat' from constructor [breaking]

Fabian Peter Hammerle 8 лет назад
Родитель
Сommit
e45cec79d6
2 измененных файлов с 3 добавлено и 48 удалено
  1. 3 11
      ioex/datetimeex.py
  2. 0 37
      tests/datetimeex/test_period.py

+ 3 - 11
ioex/datetimeex.py

@@ -117,17 +117,9 @@ class Period(object):
         always_accept_none=True,
     )
 
-    def __init__(self, start=None, end=None, isoformat=None):
-        if (start or end) and isoformat:
-            raise AttributeError(
-                'when providing isoformat no other'
-                    + ' parameters may be specified',
-            )
-        elif isoformat:
-            self.isoformat = isoformat
-        else:
-            self.start = start
-            self.end = end
+    def __init__(self, start=None, end=None):
+        self.start = start
+        self.end = end
 
     @property
     def isoformat(self):

+ 0 - 37
tests/datetimeex/test_period.py

@@ -28,43 +28,6 @@ def test_init_start_end_fail(start, end):
         ioex.datetimeex.Period(start=start, end=end)
 
 
-@pytest.mark.parametrize(('start', 'end', 'iso'), [
-    [
-        datetime.datetime(2016, 7, 24, 12, 20, 0, microsecond=25500),
-        datetime.datetime(
-            2016, 7, 24, 12, 21, 0,
-            microsecond=130000,
-            tzinfo=pytz.utc,
-        ),
-        '2016-07-24T12:20:00.0255/2016-07-24T12:21:00.13Z',
-    ],
-])
-def test_init_isoformat(start, end, iso):
-    p = ioex.datetimeex.Period(isoformat=iso)
-    assert p.start == start
-    assert p.end == end
-
-
-@pytest.mark.parametrize(('params'), [
-    {
-        'start': datetime.datetime(2016, 7, 24, 12, 20, 0),
-        'end': datetime.datetime(2016, 7, 24, 12, 21, 0),
-        'isoformat': '2016-07-24T12:20:00Z/2016-07-24T12:21:00Z',
-    },
-    {
-        'start': datetime.datetime(2016, 7, 24, 12, 20, 0),
-        'isoformat': '2016-07-24T12:20:00Z/2016-07-24T12:21:00Z',
-    },
-    {
-        'end': datetime.datetime(2016, 7, 24, 12, 21, 0),
-        'isoformat': '2016-07-24T12:20:00Z/2016-07-24T12:21:00Z',
-    },
-])
-def test_init_param_fail(params):
-    with pytest.raises(AttributeError):
-        ioex.datetimeex.Period(**params)
-
-
 @pytest.mark.parametrize(('start'), [
     datetime.datetime(2016, 7, 24, 12, 21),
     None,