本文整理汇总了Python中testify.assertions.assert_equal函数的典型用法代码示例。如果您正苦于以下问题:Python assert_equal函数的具体用法?Python assert_equal怎么用?Python assert_equal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_equal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_message_param_not_deprecated
def test_message_param_not_deprecated(self):
with warnings.catch_warnings(record=True) as w:
assertions.assert_all_not_match_regex("qux",
["foobar", "barbaz"],
message="This is a message")
assertions.assert_equal(len(w), 0)
示例2: test_deprecated_msg_param
def test_deprecated_msg_param(self):
with warnings.catch_warnings(record=True) as w:
assertions.assert_is_not(False, None, msg="This is a message")
assertions.assert_equal(len(w), 1)
assert issubclass(w[-1].category, DeprecationWarning)
assertions.assert_in("msg is deprecated", str(w[-1].message))
示例3: test
def test(self):
super(SimpleTestCase, self).test()
assert_equal(
self.lines,
['first', '1', 'second', '2.0', 'third', 'asdf', 'fourth', 'ohai',
'fifth', 'hommage à jack'
]
)
示例4: test_build_reader
def test_build_reader(self, mock_get_namespace):
config_key, validator, namespace = 'the_key', mock.Mock(), 'the_name'
reader = readers.build_reader(validator, namespace)
value = reader(config_key)
mock_get_namespace.assert_called_with(namespace)
validator.assert_called_with(
mock_get_namespace.return_value.get.return_value)
assert_equal(value, validator.return_value)
示例5: test
def test(self):
super(TestCase, self).test()
expected_lines = ['self.bar %s' % (BAR_VALUE,),
'self.counter 0',
'self.bar still %s' % (BAR_VALUE,),
'self.counter now 1',
'asdf asdf']
assert_equal(self.lines, expected_lines)
示例6: test
def test(self):
super(SubclassTestCase, self).test()
assert_equal(self.lines,
['simple_subclass::first',
'simple_subclass::second',
# test that we dispatched correctly to the superclass method
'simple_superclass::second',
])
示例7: test_can_hash
def test_can_hash(self):
# Only immutable objects are hashable, and hashable objects can be dict keys.
fd1 = fdict(a=1, b=2)
fd2 = fdict({'a':1, 'b':2})
mydict = {fd1:1}
mydict[fd2] = 2
T.assert_equal(mydict[fd1], 2)
示例8: test_list_tests_json
def test_list_tests_json(self):
output = test_call([
sys.executable, '-m', 'testify.test_program',
'--list-tests', 'testing_suite',
'--list-tests-format', 'json',
])
assert_equal(output, '''\
{"suites": [], "test": "testing_suite.example_test ExampleTestCase.test_one"}
{"suites": [], "test": "testing_suite.example_test ExampleTestCase.test_two"}
{"suites": [], "test": "testing_suite.example_test SecondTestCase.test_one"}''')
示例9: test_client_returns_zero_on_success
def test_client_returns_zero_on_success(self):
server_process = subprocess.Popen(
["python", "-m", "testify.test_program", "testing_suite.example_test", "--serve", "9001"],
stdout=open(os.devnull, "w"),
stderr=open(os.devnull, "w"),
)
# test_call has the side-effect of asserting the return code is 0
ret = test_call(["python", "-m", "testify.test_program", "--connect", "localhost:9001"])
assert_in("PASSED", ret)
assert_equal(server_process.wait(), 0)
示例10: test
def test(self):
super(TestCase, self).test()
assert_equal(self.lines, [
"I'm OK",
"I'm OK",
"The alphabet begins with a b c d e",
"The interpolant is interpolated",
"I'm OK still",
"Success!",
])
示例11: test
def test(self):
super(TestCase, self).test()
expected_lines = [
''.join(' %d' % (num,) for num in xrange(10)),
'0 a',
'1 b',
'2 c',
]
assert_equal(self.lines, expected_lines)
示例12: test
def test(self):
super(SimpleTestCase, self).test()
# sanity check: Python correctly decoded the UTF-8 characters in this file:
assert_equal(display['fifth'], u'hommage \xe0 jack')
# note that 'asdf' == u'asdf', so we don't need to explicitly prefix the
# literals here with u:
assert_equal(
self.lines,
['first', '1', 'second', '2.0', 'third', 'asdf', 'fourth', 'ohaiunicode',
'fifth', u'hommage \xe0 jack'
]
)
示例13: test
def test(self):
"""Default smoke test; ensure that setup runs, which ensures that compilation and templating will succeed
without throwing exceptions.
"""
self.expected_reference_counts = self.get_reference_counts()
self.run_templating()
self.expected_result = self.result
for _ in xrange(self.num_stress_test_iterations):
self.run_templating(quiet=True)
# check that the result hasn't changed:
assert_equal(self.result, self.expected_result)
assert_equal(self.get_reference_counts(), self.expected_reference_counts)
示例14: test
def test(self):
super(TestCase, self).test()
expected_lines = [
'respond: quux',
'my_func: bar',
'os.__file__: %s' % (os.__file__,),
'again: %s' % (os.__file__,),
'respond_reassignment: bat',
'in_pipes: |bat|',
DEFAULT_ARGUMENT,
'this is the second call to my_func',
]
assert_equal(self.lines, expected_lines)
示例15: test_repr
def test_repr(self):
fd1 = fdict(a=1, b=2)
T.assert_equal(repr(fd1), "fdict({'a': 1, 'b': 2})")
T.assert_equal(eval(repr(fd1)), fd1)
fd2 = fdict(c=3, **fd1)
T.assert_equal(repr(fd2), "fdict({'a': 1, 'c': 3, 'b': 2})")
T.assert_equal(eval(repr(fd2)), fd2)