Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
knowledge_graph
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sun Long
knowledge_graph
Commits
bdaa7729
Commit
bdaa7729
authored
May 07, 2022
by
lyh3024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
Change-Id: I296672fc00505e6662ad45254a96de63c488c0c0
parent
989b2fd3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
2 deletions
+43
-2
tests.py
route/tests.py
+43
-2
No files found.
route/tests.py
View file @
bdaa7729
import
random
from
neomodel
import
db
from
datetime
import
datetime
from
route.models
import
RouteIp
,
FirstIp
,
EndIp
...
...
@@ -26,6 +28,45 @@ def test(i):
r4
.
save
()
def
test1
(
i
):
province
=
[
'四川'
,
'北京'
,
'上海'
,
'山东'
]
city
=
{
'四川'
:
'成都'
,
'北京'
:
'海淀'
,
'上海'
:
'浦东'
,
'山东'
:
'青岛'
,
}
isp
=
[
'电信'
,
'联通'
,
'移动'
]
t1
=
datetime
(
year
=
2022
,
month
=
1
,
day
=
i
)
ip1
=
'127.1.1.'
+
str
(
i
)
ip3
=
'192.192.192.'
+
str
(
i
)
province1
=
province
[
random
.
randint
(
0
,
3
)]
city1
=
city
[
province1
]
isp1
=
isp
[
random
.
randint
(
0
,
2
)]
province3
=
province
[
random
.
randint
(
0
,
3
)]
city3
=
city
[
province3
]
isp3
=
isp
[
random
.
randint
(
0
,
2
)]
n1
=
FirstIp
(
ip
=
ip1
,
country
=
'中国'
,
province
=
province1
,
city
=
city1
,
isp
=
isp1
,
start_ip
=
ip1
,
root_ip
=
ip3
)
n3
=
EndIp
(
ip
=
ip3
,
country
=
'中国'
,
province
=
province3
,
city
=
city3
,
isp
=
isp3
,
start_ip
=
ip1
,
root_ip
=
ip3
)
n1
.
save
()
n3
.
save
()
pre
=
n1
for
i
in
range
(
random
.
randint
(
3
,
10
)):
ip2
=
str
(
random
.
randint
(
0
,
255
))
+
'.'
+
str
(
random
.
randint
(
0
,
255
))
+
'.10.'
+
str
(
i
)
province2
=
province
[
random
.
randint
(
0
,
3
)]
city2
=
city
[
province2
]
isp2
=
isp
[
random
.
randint
(
0
,
2
)]
n2
=
RouteIp
(
ip
=
ip2
,
country
=
'中国'
,
province
=
province2
,
city
=
city2
,
isp
=
isp2
,
start_ip
=
ip1
,
root_ip
=
ip3
)
n2
.
save
()
r
=
pre
.
next_ip
.
connect
(
n2
,
{
"index"
:
"123"
+
str
(
ip2
),
'date'
:
t1
})
r
.
save
()
pre
=
n2
r
=
pre
.
next_ip
.
connect
(
n3
,
{
"index"
:
"123"
+
str
(
ip3
),
'date'
:
t1
})
r
.
save
()
if
__name__
==
"__main__"
:
for
i
in
range
(
20
):
test
(
i
)
for
i
in
range
(
1
,
20
):
test
1
(
i
)
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