Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
cc9e5369
Commit
cc9e5369
authored
Jan 31, 2013
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Plain Diff
Added test to ensure localized calendar methods return strings and not bytes.
parents
d72bfe9e
f9fcdb7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
Lib/test/test_calendar.py
Lib/test/test_calendar.py
+13
-3
No files found.
Lib/test/test_calendar.py
View file @
cc9e5369
...
...
@@ -457,11 +457,21 @@ class CalendarTestCase(unittest.TestCase):
# (it is still not thread-safe though)
old_october
=
calendar
.
TextCalendar
().
formatmonthname
(
2010
,
10
,
10
)
try
:
calendar
.
LocaleTextCalendar
(
locale
=
''
).
formatmonthname
(
2010
,
10
,
10
)
cal
=
calendar
.
LocaleTextCalendar
(
locale
=
''
)
local_weekday
=
cal
.
formatweekday
(
1
,
10
)
local_month
=
cal
.
formatmonthname
(
2010
,
10
,
10
)
except
locale
.
Error
:
# cannot set the system default locale -- skip rest of test
return
calendar
.
LocaleHTMLCalendar
(
locale
=
''
).
formatmonthname
(
2010
,
10
)
raise
unittest
.
SkipTest
(
'cannot set the system default locale'
)
self
.
assertIsInstance
(
local_weekday
,
str
)
self
.
assertIsInstance
(
local_month
,
str
)
self
.
assertEqual
(
len
(
local_weekday
),
10
)
self
.
assertGreaterEqual
(
len
(
local_month
),
10
)
cal
=
calendar
.
LocaleHTMLCalendar
(
locale
=
''
)
local_weekday
=
cal
.
formatweekday
(
1
)
local_month
=
cal
.
formatmonthname
(
2010
,
10
)
self
.
assertIsInstance
(
local_weekday
,
str
)
self
.
assertIsInstance
(
local_month
,
str
)
new_october
=
calendar
.
TextCalendar
().
formatmonthname
(
2010
,
10
,
10
)
self
.
assertEqual
(
old_october
,
new_october
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment