X7ROOT File Manager
Current Path:
/lib/python2.7/site-packages/pymysql/tests
lib
/
python2.7
/
site-packages
/
pymysql
/
tests
/
📁
..
📄
__init__.py
(600 B)
📄
__init__.pyc
(773 B)
📄
__init__.pyo
(773 B)
📄
base.py
(2.64 KB)
📄
base.pyc
(3.64 KB)
📄
base.pyo
(3.64 KB)
📄
test_DictCursor.py
(4.51 KB)
📄
test_DictCursor.pyc
(5.21 KB)
📄
test_DictCursor.pyo
(5.21 KB)
📄
test_SSCursor.py
(3.83 KB)
📄
test_SSCursor.pyc
(3.29 KB)
📄
test_SSCursor.pyo
(3.29 KB)
📄
test_basic.py
(14.54 KB)
📄
test_basic.pyc
(14.09 KB)
📄
test_basic.pyo
(14.09 KB)
📄
test_connection.py
(23.71 KB)
📄
test_connection.pyc
(24.2 KB)
📄
test_connection.pyo
(24.16 KB)
📄
test_converters.py
(2.14 KB)
📄
test_converters.pyc
(3.51 KB)
📄
test_converters.pyo
(3.51 KB)
📄
test_cursor.py
(4.09 KB)
📄
test_cursor.pyc
(4.25 KB)
📄
test_cursor.pyo
(4.21 KB)
📄
test_err.py
(670 B)
📄
test_err.pyc
(1.29 KB)
📄
test_err.pyo
(1.29 KB)
📄
test_issues.py
(19.8 KB)
📄
test_issues.pyc
(19.88 KB)
📄
test_issues.pyo
(19.82 KB)
📄
test_load_local.py
(3.5 KB)
📄
test_load_local.pyc
(3.93 KB)
📄
test_load_local.pyo
(3.93 KB)
📄
test_nextset.py
(1.81 KB)
📄
test_nextset.pyc
(2.88 KB)
📄
test_nextset.pyo
(2.88 KB)
📄
test_optionfile.py
(737 B)
📄
test_optionfile.pyc
(1.25 KB)
📄
test_optionfile.pyo
(1.25 KB)
📁
thirdparty
Editing: test_converters.py
import datetime from unittest import TestCase from pymysql._compat import PY2 from pymysql import converters __all__ = ["TestConverter"] class TestConverter(TestCase): def test_escape_string(self): self.assertEqual( converters.escape_string(u"foo\nbar"), u"foo\\nbar" ) if PY2: def test_escape_string_bytes(self): self.assertEqual( converters.escape_string(b"foo\nbar"), b"foo\\nbar" ) def test_convert_datetime(self): expected = datetime.datetime(2007, 2, 24, 23, 6, 20) dt = converters.convert_datetime('2007-02-24 23:06:20') self.assertEqual(dt, expected) def test_convert_datetime_with_fsp(self): expected = datetime.datetime(2007, 2, 24, 23, 6, 20, 511581) dt = converters.convert_datetime('2007-02-24 23:06:20.511581') self.assertEqual(dt, expected) def _test_convert_timedelta(self, with_negate=False, with_fsp=False): d = {'hours': 789, 'minutes': 12, 'seconds': 34} s = '%(hours)s:%(minutes)s:%(seconds)s' % d if with_fsp: d['microseconds'] = 511581 s += '.%(microseconds)s' % d expected = datetime.timedelta(**d) if with_negate: expected = -expected s = '-' + s tdelta = converters.convert_timedelta(s) self.assertEqual(tdelta, expected) def test_convert_timedelta(self): self._test_convert_timedelta(with_negate=False, with_fsp=False) self._test_convert_timedelta(with_negate=True, with_fsp=False) def test_convert_timedelta_with_fsp(self): self._test_convert_timedelta(with_negate=False, with_fsp=True) self._test_convert_timedelta(with_negate=False, with_fsp=True) def test_convert_time(self): expected = datetime.time(23, 6, 20) time_obj = converters.convert_time('23:06:20') self.assertEqual(time_obj, expected) def test_convert_time_with_fsp(self): expected = datetime.time(23, 6, 20, 511581) time_obj = converters.convert_time('23:06:20.511581') self.assertEqual(time_obj, expected)
Upload File
Create Folder