Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mwclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WebU
shared
mwclient
Commits
0c115f9b
Commit
0c115f9b
authored
6 months ago
by
Marc Troelitzsch
Committed by
Marc Trölitzsch
6 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Add test-cases for Site.version_tuple_from_generator
parent
c8f742dd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_client.py
+34
-7
34 additions, 7 deletions
test/test_client.py
with
34 additions
and
7 deletions
test/test_client.py
+
34
−
7
View file @
0c115f9b
from
io
import
StringIO
import
json
import
logging
import
time
import
unittest
import
unittest.mock
as
mock
from
io
import
StringIO
import
pkg_resources
# part of setuptools
import
pytest
import
mwclient
import
logging
import
requests
import
responses
import
pkg_resources
# part of setuptools
import
time
import
json
from
requests_oauthlib
import
OAuth1
import
unittest.mock
as
mock
import
mwclient
if
__name__
==
"
__main__
"
:
print
()
...
...
@@ -730,6 +731,32 @@ class TestClientApiMethods(TestCase):
assert
revisions
[
1
][
'
revid
'
]
==
689816909
class
TestVersionTupleFromGenerator
:
@pytest.mark.parametrize
(
'
version, expected
'
,
[
(
'
MediaWiki 1.24
'
,
(
1
,
24
)),
(
'
MediaWiki 1.24.0
'
,
(
1
,
24
,
0
)),
(
'
MediaWiki 1.24.0-wmf.1
'
,
(
1
,
24
,
0
,
'
-wmf
'
,
1
)),
(
'
MediaWiki 1.24.1alpha
'
,
(
1
,
24
,
1
,
'
alpha
'
)),
(
'
MediaWiki 1.24.1alpha1
'
,
(
1
,
24
,
1
,
'
alpha1
'
)),
(
'
MediaWiki 1.24.1-rc.3
'
,
(
1
,
24
,
1
,
'
-rc
'
,
3
)),
])
def
test_version_tuple_from_generator
(
self
,
version
,
expected
):
assert
mwclient
.
Site
.
version_tuple_from_generator
(
version
)
==
expected
def
test_version_tuple_from_generator_empty
(
self
):
with
pytest
.
raises
(
mwclient
.
errors
.
MediaWikiVersionError
):
mwclient
.
Site
.
version_tuple_from_generator
(
''
)
def
test_version_tuple_from_generator_invalid_prefix
(
self
):
with
pytest
.
raises
(
mwclient
.
errors
.
MediaWikiVersionError
):
mwclient
.
Site
.
version_tuple_from_generator
(
'
Foo 1.24.1
'
)
def
test_version_tuple_from_generator_no_minor
(
self
):
with
pytest
.
raises
(
mwclient
.
errors
.
MediaWikiVersionError
):
mwclient
.
Site
.
version_tuple_from_generator
(
'
MediaWiki 1
'
)
class
TestClientUploadArgs
(
TestCase
):
def
setUp
(
self
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment