Citrus框架 - 使用Java DSL验证JSON响应(Citrus Framework - Validate JSON response with Java DSL)
我检查了柑橘文档,但我找不到一个例子。 我的代码是以下风格:
http() .client(something) .receive() .response(HttpStatus.OK) .messageType(MessageType.JSON);
我如何在JSON响应中检查一个标记,例如它包含正则表达式的数字和字母?
I have checked the Citrus documentation, but I could not find an example. My code is in the following style:
http() .client(something) .receive() .response(HttpStatus.OK) .messageType(MessageType.JSON);
How can I check a token in the JSON response, that it contains only numbers and letters for instance with regular expressions?
原文:https://stackoverflow.com/questions/41469691
更新时间:2022-07-06 08:07
最满意答案
没关系。 当然,你可以这样做:
data.append(dict(zip(('name', 'surname', 'phone', 'address', 'email', 'etc'), line.split(";", 6))))
但你的变体更具可读性。
It is ok. Sure, you may do something like:
data.append(dict(zip(('name', 'surname', 'phone', 'address', 'email', 'etc'), line.split(";", 6))))
but your variant is more readable.
相关问答
更多-
链接方法调用Python中的缩进样式[duplicate](Chained method calls indentation style in Python [duplicate])[2023-06-09]
这是一个行连续字符优于打开括号的情况。 ShortName.objects.distinct() \ .filter().values() # looks better 随着方法名称越来越长,方法开始引用参数,这种风格的需求变得越来越明显: return some_collection.get_objects(locator=l5) \ .get_distinct(case_insensitive=True) \ ... -
Python中旧样式和新样式类的区别是什么?(What is the difference between old style and new style classes in Python?)[2023-06-29]
来自http://docs.python.org/2/reference/datamodel.html#new-style-and-classic-classes : 根据Python 2.1,老式的类是用户可以使用的唯一风格。 (旧式)类的概念与类型的概念无关:如果x是旧式类的实例,则x.__class__指定x的类,但type(x)始终为。 这反映了这样一个事实,即所有旧样式的实例,独立于其类,都是使用一个称为实例的单一内置类型来实现的。 在Python 2.2中引入 ... -
没关系。 当然,你可以这样做: data.append(dict(zip(('name', 'surname', 'phone', 'address', 'email', 'etc'), line.split(";", 6)))) 但你的变体更具可读性。 It is ok. Sure, you may do something like: data.append(dict(zip(('name', 'surname', 'phone', 'address', 'e ...
-
你可以做到,但这可能是一个坏主意。 坚持语言习惯可以让你与其他开发者分享代码。 使用选项卡切换大括号会让任何想要修补代码的C专业人员感到困惑。 话虽如此, nobraces转换标签大括号: 无论如何,我仍然使用C编写嵌入式编程合同,而Tim Hatch的pybraces让我为C编写了一个模拟器,它为C语言提供了Python风格的缩进。 另请参见Python如何影响我的C / C ++大括号作者:Eli Bendersky。 You can do it, but it's probably a bad ide ...
-
PEP 8遵循第一人称单数。 Django文档标准遵循第三人称单数。 前者是标准的。 PEP 8 follows the first person singular. Django documentation standard follows the third person singular. The former one is standard.
-
如何避免在xlsxwriter(Python)中覆盖单元格样式?(How to avoid overwriting of cell style format in xlsxwriter (Python)?)[2021-08-11]
没有什么可以阻止你定义多种格式如下: import xlsxwriter workbook = xlsxwriter.Workbook('test.xlsx') worksheet = workbook.add_worksheet() percent_format_1 = workbook.add_format() percent_format_1.set_num_format('0"%"') percent_format_2 = workbook.add_format() percent_forma ... -
Python断言样式(Python assertion style)[2021-09-23]
如果调用函数期望在成功时输入0,在失败时输入-1,那么我会写: def prepare_for_connection(*args, **kwargs): if (self.handle is not None): return -1 if not (isinstance(port_number, int) or isinstance(port_number, float)): return -1 if port_number < 0: ... -
Python 3没有写属性?(Python 3 no write attribute?)[2022-07-06]
问题只是你将两个参数反转为pickle.dump 。 顺便说一下,最好尽可能地编写一个排序,运行,演示脚本。 这样其他人就可以轻松地运行它。 这是一个可修复的可运行解决方案 #!/usr/bin/env python3 import pickle from passlib.hash import pbkdf2_sha256 hash = pbkdf2_sha256.encrypt("foo", rounds=200000, salt_size=16) password = open("pass.pkl" ... -
如何使用样式编写php:“”(How to write php using style:“”)[2019-10-15]
问题是你使用'作为style属性值的分隔符和括号内的URL。 第二个'正在结束价值。 url(...)样式中的url(...)不需要引用,因此您只需编写: echo ""; The problem is that you're using ' as both the delimiter around the style attribute's va ... -
您可以使用生成器生成bar值; 你有一个不需要的发电机级别: [bar for bar in (x.bar for x in somelist if x.foo > 10) if bar.baz.startswith('/')] 您可以先将该嵌套生成器分配给变量: bars = (x.bar for x in somelist if x.foo > 10) [bar for bar in bars if bar.baz.startswith('/')] 如果你想保持在行长度限制内。 生成器只会消耗一次, ...