Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
4d3f18f2
Kaydet (Commit)
4d3f18f2
authored
Tem 01, 2009
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fix a few cases where automated fail -> assert translation messed up
Thanks Joe Amenta
üst
6b0032f2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
25 deletions
+25
-25
test_internals.py
Lib/ctypes/test/test_internals.py
+2
-2
test_logging.py
Lib/test/test_logging.py
+23
-23
No files found.
Lib/ctypes/test/test_internals.py
Dosyayı görüntüle @
4d3f18f2
...
@@ -18,7 +18,7 @@ What about pointers?
...
@@ -18,7 +18,7 @@ What about pointers?
"""
"""
class
ObjectsTestCase
(
unittest
.
TestCase
):
class
ObjectsTestCase
(
unittest
.
TestCase
):
def
assert
True
Same
(
self
,
a
,
b
):
def
assertSame
(
self
,
a
,
b
):
self
.
assertEqual
(
id
(
a
),
id
(
b
))
self
.
assertEqual
(
id
(
a
),
id
(
b
))
def
test_ints
(
self
):
def
test_ints
(
self
):
...
@@ -33,7 +33,7 @@ class ObjectsTestCase(unittest.TestCase):
...
@@ -33,7 +33,7 @@ class ObjectsTestCase(unittest.TestCase):
self
.
assertEqual
(
3
,
grc
(
s
))
self
.
assertEqual
(
3
,
grc
(
s
))
cs
=
c_char_p
(
s
)
cs
=
c_char_p
(
s
)
self
.
assertEqual
(
4
,
grc
(
s
))
self
.
assertEqual
(
4
,
grc
(
s
))
self
.
assert
True
Same
(
cs
.
_objects
,
s
)
self
.
assertSame
(
cs
.
_objects
,
s
)
def
test_simple_struct
(
self
):
def
test_simple_struct
(
self
):
class
X
(
Structure
):
class
X
(
Structure
):
...
...
Lib/test/test_logging.py
Dosyayı görüntüle @
4d3f18f2
...
@@ -99,7 +99,7 @@ class BaseTest(unittest.TestCase):
...
@@ -99,7 +99,7 @@ class BaseTest(unittest.TestCase):
finally
:
finally
:
logging
.
_releaseLock
()
logging
.
_releaseLock
()
def
assert
True
log_lines
(
self
,
expected_values
,
stream
=
None
):
def
assert
_
log_lines
(
self
,
expected_values
,
stream
=
None
):
"""Match the collected log lines against the regular expression
"""Match the collected log lines against the regular expression
self.expected_log_pat, and compare the extracted group values to
self.expected_log_pat, and compare the extracted group values to
the expected_values list of tuples."""
the expected_values list of tuples."""
...
@@ -165,7 +165,7 @@ class BuiltinLevelsTest(BaseTest):
...
@@ -165,7 +165,7 @@ class BuiltinLevelsTest(BaseTest):
INF
.
debug
(
m
())
INF
.
debug
(
m
())
self
.
assert
True
log_lines
([
self
.
assert
_
log_lines
([
(
'ERR'
,
'CRITICAL'
,
'1'
),
(
'ERR'
,
'CRITICAL'
,
'1'
),
(
'ERR'
,
'ERROR'
,
'2'
),
(
'ERR'
,
'ERROR'
,
'2'
),
(
'INF'
,
'CRITICAL'
,
'3'
),
(
'INF'
,
'CRITICAL'
,
'3'
),
...
@@ -197,7 +197,7 @@ class BuiltinLevelsTest(BaseTest):
...
@@ -197,7 +197,7 @@ class BuiltinLevelsTest(BaseTest):
INF_ERR
.
info
(
m
())
INF_ERR
.
info
(
m
())
INF_ERR
.
debug
(
m
())
INF_ERR
.
debug
(
m
())
self
.
assert
True
log_lines
([
self
.
assert
_
log_lines
([
(
'INF.ERR'
,
'CRITICAL'
,
'1'
),
(
'INF.ERR'
,
'CRITICAL'
,
'1'
),
(
'INF.ERR'
,
'ERROR'
,
'2'
),
(
'INF.ERR'
,
'ERROR'
,
'2'
),
])
])
...
@@ -228,7 +228,7 @@ class BuiltinLevelsTest(BaseTest):
...
@@ -228,7 +228,7 @@ class BuiltinLevelsTest(BaseTest):
INF_ERR_UNDEF
.
info
(
m
())
INF_ERR_UNDEF
.
info
(
m
())
INF_ERR_UNDEF
.
debug
(
m
())
INF_ERR_UNDEF
.
debug
(
m
())
self
.
assert
True
log_lines
([
self
.
assert
_
log_lines
([
(
'INF.UNDEF'
,
'CRITICAL'
,
'1'
),
(
'INF.UNDEF'
,
'CRITICAL'
,
'1'
),
(
'INF.UNDEF'
,
'ERROR'
,
'2'
),
(
'INF.UNDEF'
,
'ERROR'
,
'2'
),
(
'INF.UNDEF'
,
'WARNING'
,
'3'
),
(
'INF.UNDEF'
,
'WARNING'
,
'3'
),
...
@@ -256,7 +256,7 @@ class BuiltinLevelsTest(BaseTest):
...
@@ -256,7 +256,7 @@ class BuiltinLevelsTest(BaseTest):
GRANDCHILD
.
debug
(
m
())
GRANDCHILD
.
debug
(
m
())
CHILD
.
debug
(
m
())
CHILD
.
debug
(
m
())
self
.
assert
True
log_lines
([
self
.
assert
_
log_lines
([
(
'INF.BADPARENT.UNDEF'
,
'CRITICAL'
,
'1'
),
(
'INF.BADPARENT.UNDEF'
,
'CRITICAL'
,
'1'
),
(
'INF.BADPARENT.UNDEF'
,
'INFO'
,
'2'
),
(
'INF.BADPARENT.UNDEF'
,
'INFO'
,
'2'
),
(
'INF.BADPARENT'
,
'CRITICAL'
,
'3'
),
(
'INF.BADPARENT'
,
'CRITICAL'
,
'3'
),
...
@@ -285,7 +285,7 @@ class BasicFilterTest(BaseTest):
...
@@ -285,7 +285,7 @@ class BasicFilterTest(BaseTest):
spam_eggs_fish
.
info
(
self
.
next_message
())
# Good.
spam_eggs_fish
.
info
(
self
.
next_message
())
# Good.
spam_bakedbeans
.
info
(
self
.
next_message
())
spam_bakedbeans
.
info
(
self
.
next_message
())
self
.
assert
True
log_lines
([
self
.
assert
_
log_lines
([
(
'spam.eggs'
,
'INFO'
,
'2'
),
(
'spam.eggs'
,
'INFO'
,
'2'
),
(
'spam.eggs.fish'
,
'INFO'
,
'3'
),
(
'spam.eggs.fish'
,
'INFO'
,
'3'
),
])
])
...
@@ -367,7 +367,7 @@ class CustomLevelsAndFiltersTest(BaseTest):
...
@@ -367,7 +367,7 @@ class CustomLevelsAndFiltersTest(BaseTest):
self
.
root_logger
.
setLevel
(
VERBOSE
)
self
.
root_logger
.
setLevel
(
VERBOSE
)
# Levels >= 'Verbose' are good.
# Levels >= 'Verbose' are good.
self
.
log_at_all_levels
(
self
.
root_logger
)
self
.
log_at_all_levels
(
self
.
root_logger
)
self
.
assert
True
log_lines
([
self
.
assert
_
log_lines
([
(
'Verbose'
,
'5'
),
(
'Verbose'
,
'5'
),
(
'Sociable'
,
'6'
),
(
'Sociable'
,
'6'
),
(
'Effusive'
,
'7'
),
(
'Effusive'
,
'7'
),
...
@@ -382,7 +382,7 @@ class CustomLevelsAndFiltersTest(BaseTest):
...
@@ -382,7 +382,7 @@ class CustomLevelsAndFiltersTest(BaseTest):
try
:
try
:
# Levels >= 'Sociable' are good.
# Levels >= 'Sociable' are good.
self
.
log_at_all_levels
(
self
.
root_logger
)
self
.
log_at_all_levels
(
self
.
root_logger
)
self
.
assert
True
log_lines
([
self
.
assert
_
log_lines
([
(
'Sociable'
,
'6'
),
(
'Sociable'
,
'6'
),
(
'Effusive'
,
'7'
),
(
'Effusive'
,
'7'
),
(
'Terse'
,
'8'
),
(
'Terse'
,
'8'
),
...
@@ -413,12 +413,12 @@ class CustomLevelsAndFiltersTest(BaseTest):
...
@@ -413,12 +413,12 @@ class CustomLevelsAndFiltersTest(BaseTest):
(
'Taciturn'
,
'9'
),
(
'Taciturn'
,
'9'
),
(
'Silent'
,
'10'
),
(
'Silent'
,
'10'
),
]
]
self
.
assert
True
log_lines
(
first_lines
)
self
.
assert
_
log_lines
(
first_lines
)
specific_filter
=
VerySpecificFilter
()
specific_filter
=
VerySpecificFilter
()
self
.
root_logger
.
addFilter
(
specific_filter
)
self
.
root_logger
.
addFilter
(
specific_filter
)
self
.
log_at_all_levels
(
self
.
root_logger
)
self
.
log_at_all_levels
(
self
.
root_logger
)
self
.
assert
True
log_lines
(
first_lines
+
[
self
.
assert
_
log_lines
(
first_lines
+
[
# Not only 'Garrulous' is still missing, but also 'Sociable'
# Not only 'Garrulous' is still missing, but also 'Sociable'
# and 'Taciturn'
# and 'Taciturn'
(
'Boring'
,
'11'
),
(
'Boring'
,
'11'
),
...
@@ -458,9 +458,9 @@ class MemoryHandlerTest(BaseTest):
...
@@ -458,9 +458,9 @@ class MemoryHandlerTest(BaseTest):
# The memory handler flushes to its target handler based on specific
# The memory handler flushes to its target handler based on specific
# criteria (message count and message level).
# criteria (message count and message level).
self
.
mem_logger
.
debug
(
self
.
next_message
())
self
.
mem_logger
.
debug
(
self
.
next_message
())
self
.
assert
True
log_lines
([])
self
.
assert
_
log_lines
([])
self
.
mem_logger
.
info
(
self
.
next_message
())
self
.
mem_logger
.
info
(
self
.
next_message
())
self
.
assert
True
log_lines
([])
self
.
assert
_
log_lines
([])
# This will flush because the level is >= logging.WARNING
# This will flush because the level is >= logging.WARNING
self
.
mem_logger
.
warn
(
self
.
next_message
())
self
.
mem_logger
.
warn
(
self
.
next_message
())
lines
=
[
lines
=
[
...
@@ -468,19 +468,19 @@ class MemoryHandlerTest(BaseTest):
...
@@ -468,19 +468,19 @@ class MemoryHandlerTest(BaseTest):
(
'INFO'
,
'2'
),
(
'INFO'
,
'2'
),
(
'WARNING'
,
'3'
),
(
'WARNING'
,
'3'
),
]
]
self
.
assert
True
log_lines
(
lines
)
self
.
assert
_
log_lines
(
lines
)
for
n
in
(
4
,
14
):
for
n
in
(
4
,
14
):
for
i
in
range
(
9
):
for
i
in
range
(
9
):
self
.
mem_logger
.
debug
(
self
.
next_message
())
self
.
mem_logger
.
debug
(
self
.
next_message
())
self
.
assert
True
log_lines
(
lines
)
self
.
assert
_
log_lines
(
lines
)
# This will flush because it's the 10th message since the last
# This will flush because it's the 10th message since the last
# flush.
# flush.
self
.
mem_logger
.
debug
(
self
.
next_message
())
self
.
mem_logger
.
debug
(
self
.
next_message
())
lines
=
lines
+
[(
'DEBUG'
,
str
(
i
))
for
i
in
range
(
n
,
n
+
10
)]
lines
=
lines
+
[(
'DEBUG'
,
str
(
i
))
for
i
in
range
(
n
,
n
+
10
)]
self
.
assert
True
log_lines
(
lines
)
self
.
assert
_
log_lines
(
lines
)
self
.
mem_logger
.
debug
(
self
.
next_message
())
self
.
mem_logger
.
debug
(
self
.
next_message
())
self
.
assert
True
log_lines
(
lines
)
self
.
assert
_
log_lines
(
lines
)
class
ExceptionFormatter
(
logging
.
Formatter
):
class
ExceptionFormatter
(
logging
.
Formatter
):
...
@@ -650,11 +650,11 @@ class ConfigFileTest(BaseTest):
...
@@ -650,11 +650,11 @@ class ConfigFileTest(BaseTest):
logger
.
info
(
self
.
next_message
())
logger
.
info
(
self
.
next_message
())
# Outputs a message
# Outputs a message
logger
.
error
(
self
.
next_message
())
logger
.
error
(
self
.
next_message
())
self
.
assert
True
log_lines
([
self
.
assert
_
log_lines
([
(
'ERROR'
,
'2'
),
(
'ERROR'
,
'2'
),
],
stream
=
output
)
],
stream
=
output
)
# Original logger output is empty.
# Original logger output is empty.
self
.
assert
True
log_lines
([])
self
.
assert
_
log_lines
([])
def
test_config1_ok
(
self
,
config
=
config1
):
def
test_config1_ok
(
self
,
config
=
config1
):
# A config file defining a sub-parser as well.
# A config file defining a sub-parser as well.
...
@@ -664,12 +664,12 @@ class ConfigFileTest(BaseTest):
...
@@ -664,12 +664,12 @@ class ConfigFileTest(BaseTest):
# Both will output a message
# Both will output a message
logger
.
info
(
self
.
next_message
())
logger
.
info
(
self
.
next_message
())
logger
.
error
(
self
.
next_message
())
logger
.
error
(
self
.
next_message
())
self
.
assert
True
log_lines
([
self
.
assert
_
log_lines
([
(
'INFO'
,
'1'
),
(
'INFO'
,
'1'
),
(
'ERROR'
,
'2'
),
(
'ERROR'
,
'2'
),
],
stream
=
output
)
],
stream
=
output
)
# Original logger output is empty.
# Original logger output is empty.
self
.
assert
True
log_lines
([])
self
.
assert
_
log_lines
([])
def
test_config2_failure
(
self
):
def
test_config2_failure
(
self
):
# A simple config file which overrides the default settings.
# A simple config file which overrides the default settings.
...
@@ -692,7 +692,7 @@ class ConfigFileTest(BaseTest):
...
@@ -692,7 +692,7 @@ class ConfigFileTest(BaseTest):
self
.
assertEquals
(
output
.
getvalue
(),
self
.
assertEquals
(
output
.
getvalue
(),
"ERROR:root:just testing
\n
Got a [RuntimeError]
\n
"
)
"ERROR:root:just testing
\n
Got a [RuntimeError]
\n
"
)
# Original logger output is empty
# Original logger output is empty
self
.
assert
True
log_lines
([])
self
.
assert
_
log_lines
([])
def
test_config5_ok
(
self
):
def
test_config5_ok
(
self
):
self
.
test_config1_ok
(
config
=
self
.
config5
)
self
.
test_config1_ok
(
config
=
self
.
config5
)
...
@@ -847,7 +847,7 @@ class MemoryTest(BaseTest):
...
@@ -847,7 +847,7 @@ class MemoryTest(BaseTest):
foo
.
setLevel
(
logging
.
DEBUG
)
foo
.
setLevel
(
logging
.
DEBUG
)
self
.
root_logger
.
debug
(
self
.
next_message
())
self
.
root_logger
.
debug
(
self
.
next_message
())
foo
.
debug
(
self
.
next_message
())
foo
.
debug
(
self
.
next_message
())
self
.
assert
True
log_lines
([
self
.
assert
_
log_lines
([
(
'foo'
,
'DEBUG'
,
'2'
),
(
'foo'
,
'DEBUG'
,
'2'
),
])
])
del
foo
del
foo
...
@@ -856,7 +856,7 @@ class MemoryTest(BaseTest):
...
@@ -856,7 +856,7 @@ class MemoryTest(BaseTest):
# foo has retained its settings.
# foo has retained its settings.
bar
=
logging
.
getLogger
(
"foo"
)
bar
=
logging
.
getLogger
(
"foo"
)
bar
.
debug
(
self
.
next_message
())
bar
.
debug
(
self
.
next_message
())
self
.
assert
True
log_lines
([
self
.
assert
_
log_lines
([
(
'foo'
,
'DEBUG'
,
'2'
),
(
'foo'
,
'DEBUG'
,
'2'
),
(
'foo'
,
'DEBUG'
,
'3'
),
(
'foo'
,
'DEBUG'
,
'3'
),
])
])
...
...
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