-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/fengchenfcpp/python
- Loading branch information
Showing
111 changed files
with
725 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/python | ||
# Filename : ch02/hello1.py | ||
|
||
import world1 | ||
from world1 import z | ||
from world1 import x as x2 | ||
|
||
x = 100 | ||
y = 20 | ||
|
||
print (world1.x) | ||
print (y) | ||
print (z) | ||
print (x2) | ||
print (x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# coding=utf-8 | ||
# Filename : ch02/world1.py | ||
|
||
x = '你好' | ||
y = True | ||
z = 20.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/python | ||
# Filename : ch_3_2.py | ||
|
||
x = 28 | ||
print (type(x)) | ||
|
||
y = '你好' | ||
print (type(y)) | ||
|
||
z = True | ||
print (type(z)) | ||
|
||
i = 3.14159265354 | ||
print (type(i)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# coding=utf-8 | ||
# Filename: ch5_2_1_2_snow.py | ||
|
||
i = 0 | ||
|
||
while i * i < 100099: | ||
i += 1 | ||
if i == 55: | ||
break | ||
print(str(i) + '*' + str(i) + ' =', i * i) | ||
else: | ||
print('While Over') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# coding=utf-8 | ||
# Filename: ch5_2_2_1_snow.py | ||
|
||
print("------字符串--------") | ||
for item in '我是你爸爸': | ||
print(item) | ||
|
||
numbers = [54188 ] | ||
print("---------整数列表---------") | ||
for item in numbers: | ||
print(item) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# coding=utf-8 | ||
# Filename: ch5_2_2_2.py | ||
|
||
for item in range(10): | ||
print(item) | ||
else: | ||
print('For Over') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# coding=utf-8 | ||
# Filename: ch5_2_2_2_1.py | ||
|
||
for item in range(10): | ||
print(item) | ||
if item ==30: | ||
break | ||
else: | ||
print('For Over') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# coding=utf-8 | ||
# Filename: ch5_3_1.py | ||
|
||
for item in range(10): | ||
if item == 3: | ||
break | ||
print(item) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# coding=utf-8 | ||
# Filename: ch5_3_2.py | ||
|
||
for item in range(10): | ||
if item == 2 or item == 4 or item == 6 or item == 8: | ||
continue | ||
print(item) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# coding=utf-8 | ||
# Filename: ch5_3_2.py | ||
|
||
i = 100; r = 0; s = 0; t = 0 | ||
|
||
while i < 1000: | ||
r = i // 100 | ||
s = (i - r * 100) // 10 | ||
t = i - r * 100 - s * 10 | ||
if i == (r ** 3 + s ** 3 + t ** 3): | ||
print("i = " + str(i)) | ||
|
||
i += 1 |
Binary file added
BIN
+830 Bytes
...n Frameworks with Python and Pytest/__pycache__/check_widget.cpython-310-pytest-7.1.2.pyc
Binary file not shown.
Binary file added
BIN
+585 Bytes
...ation Frameworks with Python and Pytest/__pycache__/conftest.cpython-310-pytest-7.1.2.pyc
Binary file not shown.
Binary file added
BIN
+826 Bytes
...on Frameworks with Python and Pytest/__pycache__/test_widget.cpython-310-pytest-7.1.2.pyc
Binary file not shown.
186 changes: 186 additions & 0 deletions
186
Elegant Automation Frameworks with Python and Pytest/assets/style.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
body { | ||
font-family: Helvetica, Arial, sans-serif; | ||
font-size: 12px; | ||
/* do not increase min-width as some may use split screens */ | ||
min-width: 800px; | ||
color: #999; | ||
} | ||
|
||
h1 { | ||
font-size: 24px; | ||
color: black; | ||
} | ||
|
||
h2 { | ||
font-size: 16px; | ||
color: black; | ||
} | ||
|
||
p { | ||
color: black; | ||
} | ||
|
||
a { | ||
color: #999; | ||
} | ||
|
||
table { | ||
border-collapse: collapse; | ||
} | ||
|
||
/****************************** | ||
* SUMMARY INFORMATION | ||
******************************/ | ||
#environment td { | ||
padding: 5px; | ||
border: 1px solid #E6E6E6; | ||
} | ||
#environment tr:nth-child(odd) { | ||
background-color: #f6f6f6; | ||
} | ||
|
||
/****************************** | ||
* TEST RESULT COLORS | ||
******************************/ | ||
span.passed, | ||
.passed .col-result { | ||
color: green; | ||
} | ||
|
||
span.skipped, | ||
span.xfailed, | ||
span.rerun, | ||
.skipped .col-result, | ||
.xfailed .col-result, | ||
.rerun .col-result { | ||
color: orange; | ||
} | ||
|
||
span.error, | ||
span.failed, | ||
span.xpassed, | ||
.error .col-result, | ||
.failed .col-result, | ||
.xpassed .col-result { | ||
color: red; | ||
} | ||
|
||
/****************************** | ||
* RESULTS TABLE | ||
* | ||
* 1. Table Layout | ||
* 2. Extra | ||
* 3. Sorting items | ||
* | ||
******************************/ | ||
/*------------------ | ||
* 1. Table Layout | ||
*------------------*/ | ||
#results-table { | ||
border: 1px solid #e6e6e6; | ||
color: #999; | ||
font-size: 12px; | ||
width: 100%; | ||
} | ||
#results-table th, | ||
#results-table td { | ||
padding: 5px; | ||
border: 1px solid #E6E6E6; | ||
text-align: left; | ||
} | ||
#results-table th { | ||
font-weight: bold; | ||
} | ||
|
||
/*------------------ | ||
* 2. Extra | ||
*------------------*/ | ||
.log { | ||
background-color: #e6e6e6; | ||
border: 1px solid #e6e6e6; | ||
color: black; | ||
display: block; | ||
font-family: "Courier New", Courier, monospace; | ||
height: 230px; | ||
overflow-y: scroll; | ||
padding: 5px; | ||
white-space: pre-wrap; | ||
} | ||
.log:only-child { | ||
height: inherit; | ||
} | ||
|
||
div.image { | ||
border: 1px solid #e6e6e6; | ||
float: right; | ||
height: 240px; | ||
margin-left: 5px; | ||
overflow: hidden; | ||
width: 320px; | ||
} | ||
div.image img { | ||
width: 320px; | ||
} | ||
|
||
div.video { | ||
border: 1px solid #e6e6e6; | ||
float: right; | ||
height: 240px; | ||
margin-left: 5px; | ||
overflow: hidden; | ||
width: 320px; | ||
} | ||
div.video video { | ||
overflow: hidden; | ||
width: 320px; | ||
height: 240px; | ||
} | ||
|
||
.collapsed { | ||
display: none; | ||
} | ||
|
||
.expander::after { | ||
content: " (show details)"; | ||
color: #BBB; | ||
font-style: italic; | ||
cursor: pointer; | ||
} | ||
|
||
.collapser::after { | ||
content: " (hide details)"; | ||
color: #BBB; | ||
font-style: italic; | ||
cursor: pointer; | ||
} | ||
|
||
/*------------------ | ||
* 3. Sorting items | ||
*------------------*/ | ||
.sortable { | ||
cursor: pointer; | ||
} | ||
|
||
.sort-icon { | ||
font-size: 0px; | ||
float: left; | ||
margin-right: 5px; | ||
margin-top: 5px; | ||
/*triangle*/ | ||
width: 0; | ||
height: 0; | ||
border-left: 8px solid transparent; | ||
border-right: 8px solid transparent; | ||
} | ||
.inactive .sort-icon { | ||
/*finish triangle*/ | ||
border-top: 8px solid #E6E6E6; | ||
} | ||
.asc.active .sort-icon { | ||
/*finish triangle*/ | ||
border-bottom: 8px solid #999; | ||
} | ||
.desc.active .sort-icon { | ||
/*finish triangle*/ | ||
border-top: 8px solid #999; | ||
} |
10 changes: 10 additions & 0 deletions
10
Elegant Automation Frameworks with Python and Pytest/conftest.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from pytest import fixture | ||
from selenium import webdriver | ||
|
||
@fixture(scope='function') | ||
def chrome_browser(): | ||
browser = webdriver.Chrome() | ||
yield browser | ||
|
||
# Teardown | ||
print("I am tearing down this browser") |
12 changes: 12 additions & 0 deletions
12
Elegant Automation Frameworks with Python and Pytest/pytest.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# pytest.ini | ||
[pytest] | ||
python_files = test_* | ||
python_classes = *Tests | ||
python_functions = test_* | ||
|
||
markers = | ||
smoke: marks tests as smoke (deselect with '-m "not smoke"') | ||
body: marks tests as body (deselect with '-m "not body"') | ||
engine: marks tests as engine (deselect with '-m "not engine"') | ||
entertainment: marks tests as entertainment (deselect with '-m "not entertainment"') | ||
ui: marks tests as ui (deselect with '-m "not ui"') |
Oops, something went wrong.