Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
4d05ba25
Commit
4d05ba25
authored
Aug 20, 2016
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include octal number formatting in fstring tests
parent
eb6e28cf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
tests/run/fstring.pyx
tests/run/fstring.pyx
+3
-3
No files found.
tests/run/fstring.pyx
View file @
4d05ba25
...
@@ -55,7 +55,7 @@ def format_c_numbers(signed char c, short s, int n, long l, float f, double d):
...
@@ -55,7 +55,7 @@ def format_c_numbers(signed char c, short s, int n, long l, float f, double d):
>>> print(s3)
>>> print(s3)
12f
12f
>>> print(s4)
>>> print(s4)
0C0
0C
3.14
0C0
14
3.14
>>> s1, s2, s3, s4 = format_c_numbers(-123, -135, -12, -12312312, -2.3456, -3.1415926)
>>> s1, s2, s3, s4 = format_c_numbers(-123, -135, -12, -12312312, -2.3456, -3.1415926)
>>> print(s1)
>>> print(s1)
...
@@ -65,7 +65,7 @@ def format_c_numbers(signed char c, short s, int n, long l, float f, double d):
...
@@ -65,7 +65,7 @@ def format_c_numbers(signed char c, short s, int n, long l, float f, double d):
>>> print(s3)
>>> print(s3)
-12f
-12f
>>> print(s4)
>>> print(s4)
-C-
0C
-3.14
-C-
14
-3.14
"""
"""
s1
=
f"
{
c
}{
s
:
4
}{
l
}{
n
}{
f
:.
3
}
"
s1
=
f"
{
c
}{
s
:
4
}{
l
}{
n
}{
f
:.
3
}
"
...
@@ -74,7 +74,7 @@ def format_c_numbers(signed char c, short s, int n, long l, float f, double d):
...
@@ -74,7 +74,7 @@ def format_c_numbers(signed char c, short s, int n, long l, float f, double d):
assert
isinstance
(
s2
,
unicode
),
type
(
s2
)
assert
isinstance
(
s2
,
unicode
),
type
(
s2
)
s3
=
f"
{
n
:
-
4
}
f"
s3
=
f"
{
n
:
-
4
}
f"
assert
isinstance
(
s3
,
unicode
),
type
(
s3
)
assert
isinstance
(
s3
,
unicode
),
type
(
s3
)
s4
=
f"
{
n
:
02
X
}{
n
:
03
X
}{
d
:
5.3
}
"
s4
=
f"
{
n
:
02
X
}{
n
:
03
o
}{
d
:
5.3
}
"
assert
isinstance
(
s4
,
unicode
),
type
(
s4
)
assert
isinstance
(
s4
,
unicode
),
type
(
s4
)
return
s1
,
s2
,
s3
,
s4
return
s1
,
s2
,
s3
,
s4
...
...
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