コード例 #1
0
ファイル: test_dtypes.py プロジェクト: chrish42/pandas
    def test_construction_from_string_error_subtype(self, string):
        # this is an invalid subtype
        msg = ("Incorrectly formatted string passed to constructor. "
               r"Valid formats include Interval or Interval\[dtype\] "
               "where dtype is numeric, datetime, or timedelta")

        with pytest.raises(TypeError, match=msg):
            IntervalDtype.construct_from_string(string)
コード例 #2
0
    def test_construction_from_string_errors(self, string):
        if isinstance(string, string_types):
            error, msg = ValueError, 'could not construct IntervalDtype'
        else:
            error, msg = TypeError, 'a string needs to be passed, got type'

        with tm.assert_raises_regex(error, msg):
            IntervalDtype.construct_from_string(string)
コード例 #3
0
ファイル: test_dtypes.py プロジェクト: vinks4u/pandas
    def test_construction_from_string_error_subtype(self, string):
        # this is an invalid subtype
        msg = ("Incorrectly formatted string passed to constructor. "
               r"Valid formats include Interval or Interval\[dtype\] "
               "where dtype is numeric, datetime, or timedelta")

        with pytest.raises(TypeError, match=msg):
            IntervalDtype.construct_from_string(string)
コード例 #4
0
ファイル: test_dtypes.py プロジェクト: mficek/pandas
    def test_construction_from_string_errors(self, string):
        if isinstance(string, string_types):
            error, msg = ValueError, 'could not construct IntervalDtype'
        else:
            error, msg = TypeError, 'a string needs to be passed, got type'

        with tm.assert_raises_regex(error, msg):
            IntervalDtype.construct_from_string(string)
コード例 #5
0
 def test_construction_from_string(self):
     result = IntervalDtype('interval[int64]')
     self.assertTrue(is_dtype_equal(self.dtype, result))
     result = IntervalDtype.construct_from_string('interval[int64]')
     self.assertTrue(is_dtype_equal(self.dtype, result))
     with pytest.raises(TypeError):
         IntervalDtype.construct_from_string('foo')
     with pytest.raises(TypeError):
         IntervalDtype.construct_from_string('interval[foo]')
     with pytest.raises(TypeError):
         IntervalDtype.construct_from_string('foo[int64]')
コード例 #6
0
ファイル: test_dtypes.py プロジェクト: tsdlovell/pandas
 def test_construction_from_string(self):
     result = IntervalDtype('interval[int64]')
     self.assertTrue(is_dtype_equal(self.dtype, result))
     result = IntervalDtype.construct_from_string('interval[int64]')
     self.assertTrue(is_dtype_equal(self.dtype, result))
     with tm.assertRaises(TypeError):
         IntervalDtype.construct_from_string('foo')
     with tm.assertRaises(TypeError):
         IntervalDtype.construct_from_string('interval[foo]')
     with tm.assertRaises(TypeError):
         IntervalDtype.construct_from_string('foo[int64]')
コード例 #7
0
ファイル: test_dtypes.py プロジェクト: cpcloud/pandas
 def test_construction_from_string(self):
     result = IntervalDtype('interval[int64]')
     assert is_dtype_equal(self.dtype, result)
     result = IntervalDtype.construct_from_string('interval[int64]')
     assert is_dtype_equal(self.dtype, result)
     with pytest.raises(TypeError):
         IntervalDtype.construct_from_string('foo')
     with pytest.raises(TypeError):
         IntervalDtype.construct_from_string('interval[foo]')
     with pytest.raises(TypeError):
         IntervalDtype.construct_from_string('foo[int64]')
コード例 #8
0
ファイル: test_dtypes.py プロジェクト: vinks4u/pandas
    def test_construction_from_string_errors(self, string):
        # these are invalid entirely
        msg = "a string needs to be passed, got type"

        with pytest.raises(TypeError, match=msg):
            IntervalDtype.construct_from_string(string)
コード例 #9
0
ファイル: test_dtypes.py プロジェクト: AnAnteup/icp5
    def test_construction_from_string_error_subtype(self, string):
        # this is an invalid subtype
        msg = 'could not construct IntervalDtype'

        with pytest.raises(TypeError, match=msg):
            IntervalDtype.construct_from_string(string)
コード例 #10
0
ファイル: test_dtypes.py プロジェクト: mficek/pandas
 def test_construction_from_string(self):
     result = IntervalDtype('interval[int64]')
     assert is_dtype_equal(self.dtype, result)
     result = IntervalDtype.construct_from_string('interval[int64]')
     assert is_dtype_equal(self.dtype, result)
コード例 #11
0
ファイル: test_dtypes.py プロジェクト: bkandel/pandas
    def test_construction_from_string_errors(self, string):
        # these are invalid entirely
        msg = 'a string needs to be passed, got type'

        with tm.assert_raises_regex(TypeError, msg):
            IntervalDtype.construct_from_string(string)
コード例 #12
0
ファイル: test_dtypes.py プロジェクト: yuanhui-yang/pandas
 def test_construction_from_string(self, dtype):
     result = IntervalDtype("interval[int64]")
     assert is_dtype_equal(dtype, result)
     result = IntervalDtype.construct_from_string("interval[int64]")
     assert is_dtype_equal(dtype, result)
コード例 #13
0
    def test_construction_from_string_error_subtype(self, string):
        # this is an invalid subtype
        msg = 'could not construct IntervalDtype'

        with tm.assert_raises_regex(TypeError, msg):
            IntervalDtype.construct_from_string(string)
コード例 #14
0
    def test_construction_from_string_errors(self, string):
        # these are invalid entirely
        msg = 'a string needs to be passed, got type'

        with tm.assert_raises_regex(TypeError, msg):
            IntervalDtype.construct_from_string(string)
コード例 #15
0
ファイル: interval.py プロジェクト: zhabzhang/pandas
 def dtype(self):
     """Return the dtype object of the underlying data"""
     return IntervalDtype.construct_from_string(str(self.left.dtype))
コード例 #16
0
 def test_construction_from_string(self):
     result = IntervalDtype('interval[int64]')
     assert is_dtype_equal(self.dtype, result)
     result = IntervalDtype.construct_from_string('interval[int64]')
     assert is_dtype_equal(self.dtype, result)
コード例 #17
0
ファイル: test_dtypes.py プロジェクト: yuanhui-yang/pandas
    def test_construction_from_string_errors(self, string):
        # these are invalid entirely
        msg = f"'construct_from_string' expects a string, got {type(string)}"

        with pytest.raises(TypeError, match=re.escape(msg)):
            IntervalDtype.construct_from_string(string)
コード例 #18
0
 def dtype(self):
     return IntervalDtype.construct_from_string(str(self.left.dtype))
コード例 #19
0
ファイル: test_dtypes.py プロジェクト: changhiskhan/pandas
    def test_construction_from_string_errors(self, string):
        # these are invalid entirely
        msg = 'a string needs to be passed, got type'

        with pytest.raises(TypeError, match=msg):
            IntervalDtype.construct_from_string(string)
コード例 #20
0
ファイル: test_dtypes.py プロジェクト: bkandel/pandas
    def test_construction_from_string_error_subtype(self, string):
        # this is an invalid subtype
        msg = 'could not construct IntervalDtype'

        with tm.assert_raises_regex(TypeError, msg):
            IntervalDtype.construct_from_string(string)
コード例 #21
0
ファイル: test_dtypes.py プロジェクト: changhiskhan/pandas
    def test_construction_from_string_error_subtype(self, string):
        # this is an invalid subtype
        msg = 'could not construct IntervalDtype'

        with pytest.raises(TypeError, match=msg):
            IntervalDtype.construct_from_string(string)
コード例 #22
0
ファイル: interval.py プロジェクト: qdxt/python
 def dtype(self):
     return IntervalDtype.construct_from_string(str(self.left.dtype))
コード例 #23
0
ファイル: interval.py プロジェクト: mficek/pandas
 def dtype(self):
     """Return the dtype object of the underlying data"""
     return IntervalDtype.construct_from_string(str(self.left.dtype))