python nosetest框架有一些命令行选项,可以包含,排除和匹配可以分别包含/排除和匹配的测试的正则表达式.
但是它们似乎没有正常工作.
[kiran@my_redhat test]$ nosetests -w cases/ -s -v -m='_size'
----------------------------------------------------------------------
Ran 0 tests in 0.001s
OK
[kiran@my_redhat test]$ grep '_size' cases/test_case_4.py
def test_fn_size_sha(self):
Run Code Online (Sandbox Code Playgroud)
正则表达式匹配鼻子框架的语义是否有问题?
我有一个应用程序,它接受搜索字符串并在一条路线中返回结果:hosts.abc.com:3000。网址不变。
我希望搜索反映在网址中,这样我就可以共享链接,并且用户不必在表单字段中进行所有选择。
eg: hosts.abc.com:3000/?type=all&query=coins
是否可以使用react-router来做到这一点?
我需要在lxml中的特定标签后获取一些信息.xml doc看起来像这样
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/
ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>Community Bank</display-name>
<description>WebGoat for Cigital</description>
<context-param>
<param-name>PropertiesPath</param-name>
<param-value>/WEB-INF/properties.txt</param-value>
<description>This is the path to the properties file from the servlet root</description>
</context-param>
<servlet>
<servlet-name>Index</servlet-name>
<servlet-class>com.cigital.boi.servlet.index</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Index</servlet-name>
<url-pattern>/index</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Index</servlet-name>
<url-pattern>/index.html</url-pattern>
</servlet-mapping>
Run Code Online (Sandbox Code Playgroud)
我想阅读com.cigital.boi.servlet.index.
我已经使用这段代码来读取servlet下的所有内容
context = etree.parse(handle)
list = parser.xpath('//servlet')
print list
Run Code Online (Sandbox Code Playgroud)
list只包含更多信息:迭代上下文字段我找到了这些行.
<Element {http://java.sun.com/xml/ns/j2ee}servlet-name at 2ad19e6eca48>
<Element {http://java.sun.com/xml/ns/j2ee}servlet-class at 2ad19e6ecaf8>
Run Code Online (Sandbox Code Playgroud)
我在想,因为我在搜索时没有包含名称空间,输出是空列表.请建议在servlet-class标签中阅读"com.cigital.boi.servlet.index"
python ×2
lxml ×1
namespaces ×1
nose ×1
react-router ×1
reactjs ×1
regex ×1
testing ×1
xml-parsing ×1