FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cecli/tests/unit/test_performance.py at main · cecli-dev/cecli · GitHub
cecli-dev
cecli
Repository navigation
Code
Issues
12
(12)
Pull requests
7
(7)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cecli
/
tests
/
unit
/
test_performance.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
27 lines (21 loc) · 840 Bytes
Breadcrumbs
cecli
/
tests
/
unit
/
test_performance.py
Copy path
File metadata and controls
27 lines (21 loc) · 840 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import
time
import
unittest
from
cecli
.
helpers
.
nested
import
deep_merge
class
TestPerformance
(
unittest
.
TestCase
):
def
test_large_arrays_performance
(
self
):
dict1
=
{
"large_array"
:
list
(
range
(
1000
))}
dict2
=
{
"large_array"
:
list
(
range
(
1000
,
2000
))}
start_time
=
time
.
time
()
deep_merge
(
dict1
,
dict2
,
deep_merge_arrays
=
True
)
end_time
=
time
.
time
()
self
.
assertLess
(
end_time
-
start_time
,
0.1
)
def
test_deep_copy_behavior
(
self
):
dict1
=
{
"a"
: [
1
],
"b"
: {
"c"
: [
2
]}}
dict2
=
{
"a"
: [
3
],
"b"
: {
"c"
: [
4
]}}
merged
=
deep_merge
(
dict1
,
dict2
,
deep_merge_arrays
=
True
)
merged
[
"a"
].
append
(
4
)
merged
[
"b"
][
"c"
].
append
(
5
)
self
.
assertEqual
(
dict1
[
"a"
], [
1
])
self
.
assertEqual
(
dict1
[
"b"
][
"c"
], [
2
])
if
__name__
==
"__main__"
:
unittest
.
main
()
Back
|
FazBrowse Home
|
New Git URL