Exemple #1
0
 def test_http_matcher(self):
     #basicConfig(level=DEBUG)
     
     http = _HttpUrl() & Eos()
     http.config.compile_to_re()
     #print(http.get_parse().matcher.tree())
     
     self.assert_literal(r'http://www.acooke.org', http)
     self.assert_literal(r'http://www.acooke.org/', http)
     self.assert_literal(r'http://www.acooke.org:80', http)
     self.assert_literal(r'http://www.acooke.org:80/', http)
     self.assert_literal(r'http://www.acooke.org/andrew', http)
     self.assert_literal(r'http://www.acooke.org:80/andrew', http)
     self.assert_literal(r'http://www.acooke.org/andrew/', http)
     self.assert_literal(r'http://www.acooke.org:80/andrew/', http)
     self.assert_literal(r'http://www.acooke.org/?foo', http)
     self.assert_literal(r'http://www.acooke.org:80/?foo', http)
     self.assert_literal(r'http://www.acooke.org/#bar', http)
     self.assert_literal(r'http://www.acooke.org:80/#bar', http)
     self.assert_literal(r'http://www.acooke.org/andrew?foo', http)
     self.assert_literal(r'http://www.acooke.org:80/andrew?foo', http)
     self.assert_literal(r'http://www.acooke.org/andrew/?foo', http)
     self.assert_literal(r'http://www.acooke.org:80/andrew/?foo', http)
     self.assert_literal(r'http://www.acooke.org/andrew#bar', http)
     self.assert_literal(r'http://www.acooke.org:80/andrew#bar', http)
     self.assert_literal(r'http://www.acooke.org/andrew/#bar', http)
     self.assert_literal(r'http://www.acooke.org:80/andrew/#bar', http)
     self.assert_literal(r'http://www.acooke.org/andrew?foo#bar', http)
     self.assert_literal(r'http://www.acooke.org:80/andrew?foo#bar', http)
     self.assert_literal(r'http://www.acooke.org/andrew/?foo#bar', http)
     self.assert_literal(r'http://www.acooke.org:80/andrew/?foo#bar', http)
     
     self.assert_fail(r'http://www.acooke.org:80/andrew/?foo#bar ', http)
     self.assert_fail(r'http://www.acooke.org:80/andrew/?foo#bar baz', http)
Exemple #2
0
#
# If you wish to allow use of your version of this file only under the
# terms of the LGPL License and not to allow others to use your version
# of this file under the MPL, indicate your decision by deleting the
# provisions above and replace them with the notice and other provisions
# required by the LGPL License.  If you do not delete the provisions
# above, a recipient may use your version of this file under either the
# MPL or the LGPL License.
'''
Performance related tests.
'''

from lepl import Eos
from lepl.apps.rfc3696 import _HttpUrl

http = _HttpUrl() & Eos()

# values are before/after adding IP addresses
# value in pares is char count; other values are timing in secs

# (89041/115471) 1.17/1.20
#http.config.clear()

# (89441/115951) 1.02/1.08
#http.config.clear().direct_eval()

# (3089/7835) 0.48/0.53
#http.config.clear().compile_to_nfa()
# (3089/7835) 0.45/0.51
#http.config.clear().compile_to_dfa()
# (3352/10148) 0.23/0.29
Exemple #3
0
# terms of the LGPL License and not to allow others to use your version
# of this file under the MPL, indicate your decision by deleting the
# provisions above and replace them with the notice and other provisions
# required by the LGPL License.  If you do not delete the provisions
# above, a recipient may use your version of this file under either the
# MPL or the LGPL License.

'''
Performance related tests.
'''

from lepl import Eos
from lepl.apps.rfc3696 import _HttpUrl


http = _HttpUrl() & Eos()

# values are before/after adding IP addresses
# value in pares is char count; other values are timing in secs

# (89041/115471) 1.17/1.20
#http.config.clear()

# (89441/115951) 1.02/1.08
#http.config.clear().direct_eval()

# (3089/7835) 0.48/0.53
#http.config.clear().compile_to_nfa()
# (3089/7835) 0.45/0.51
#http.config.clear().compile_to_dfa()
# (3352/10148) 0.23/0.29