Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
gajim
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
210
Issues
210
List
Boards
Labels
Service Desk
Milestones
Merge Requests
22
Merge Requests
22
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gajim
gajim
Commits
b243c3c0
Unverified
Commit
b243c3c0
authored
Feb 13, 2021
by
André
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move regex tests
parent
1ac4fd7a
Pipeline
#7313
canceled with stages
in 57 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
27 deletions
+36
-27
test/no_gui/test_regex.py
test/no_gui/test_regex.py
+36
-0
test/unit/test_gui_interface.py
test/unit/test_gui_interface.py
+0
-27
No files found.
test/no_gui/test_regex.py
0 → 100644
View file @
b243c3c0
import
unittest
from
gajim
import
gui
gui
.
init
(
'gtk'
)
import
gajim.common.regex
as
regex
class
Test
(
unittest
.
TestCase
):
def
test_links_regexp_entire
(
self
):
def
assert_matches_all
(
str_
):
m
=
regex
.
BASIC_REGEX
.
match
(
str_
)
# the match should equal the string
str_span
=
(
0
,
len
(
str_
))
self
.
assertEqual
(
m
.
span
(),
str_span
)
# these entire strings should be parsed as links
assert_matches_all
(
'http://google.com/'
)
assert_matches_all
(
'http://google.com'
)
assert_matches_all
(
'http://www.google.ca/search?q=xmpp'
)
assert_matches_all
(
'http://tools.ietf.org/html/draft-saintandre-rfc3920bis-05#section-12.3'
)
assert_matches_all
(
'http://en.wikipedia.org/wiki/Protocol_(computing)'
)
assert_matches_all
(
'http://en.wikipedia.org/wiki/Protocol_%28computing%29'
)
assert_matches_all
(
'mailto:test@example.org'
)
assert_matches_all
(
'xmpp:example-node@example.com'
)
assert_matches_all
(
'xmpp:example-node@example.com/some-resource'
)
assert_matches_all
(
'xmpp:example-node@example.com?message'
)
assert_matches_all
(
'xmpp://guest@example.com/support@example.com?message'
)
if
__name__
==
"__main__"
:
unittest
.
main
()
test/unit/test_gui_interface.py
View file @
b243c3c0
...
...
@@ -24,33 +24,6 @@ def close_app():
GLib
.
idle_add
(
close_app
)
app
.
app
.
run
()
def
test_links_regexp_entire
(
self
):
sut
=
Interface
()
def
assert_matches_all
(
str_
):
m
=
sut
.
basic_pattern_re
.
match
(
str_
)
# the match should equal the string
str_span
=
(
0
,
len
(
str_
))
self
.
assertEqual
(
m
.
span
(),
str_span
)
# these entire strings should be parsed as links
assert_matches_all
(
'http://google.com/'
)
assert_matches_all
(
'http://google.com'
)
assert_matches_all
(
'http://www.google.ca/search?q=xmpp'
)
assert_matches_all
(
'http://tools.ietf.org/html/draft-saintandre-rfc3920bis-05#section-12.3'
)
assert_matches_all
(
'http://en.wikipedia.org/wiki/Protocol_(computing)'
)
assert_matches_all
(
'http://en.wikipedia.org/wiki/Protocol_%28computing%29'
)
assert_matches_all
(
'mailto:test@example.org'
)
assert_matches_all
(
'xmpp:example-node@example.com'
)
assert_matches_all
(
'xmpp:example-node@example.com/some-resource'
)
assert_matches_all
(
'xmpp:example-node@example.com?message'
)
assert_matches_all
(
'xmpp://guest@example.com/support@example.com?message'
)
if
__name__
==
"__main__"
:
unittest
.
main
()
Philipp Hörist
@lovetox
mentioned in issue
#10427 (closed)
·
Feb 13, 2021
mentioned in issue
#10427 (closed)
mentioned in issue #10427
Toggle commit list
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