本文整理汇总了Python中unittest.TestCase.assertEquals方法的典型用法代码示例。如果您正苦于以下问题:Python TestCase.assertEquals方法的具体用法?Python TestCase.assertEquals怎么用?Python TestCase.assertEquals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unittest.TestCase
的用法示例。
在下文中一共展示了TestCase.assertEquals方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_tmx_manageCollisionEvents
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEquals [as 别名]
def test_tmx_manageCollisionEvents(self):
boundaries = self.game.tilemap.layers['boundaries']
walls = self.game.tilemap.layers['walls']
destination = walls.cells[walls.cells.keys()[0]]
(dx, dy) = self.__calcule_delta(self.game.perso, destination)
self.game.perso.move(dx, dy)
TestCase.assertNotEquals(self,
self.game.perso.collision_rect.y,
self.game.perso.last_coll_y)
self.game.tmx_stackCollisionEvents(self.game.perso,
self.game.tmxEvents)
self.game.tmx_manageCollisionEvents(self.game.perso,
self.game.tmxEvents)
TestCase.assertEquals(self,
self.game.perso.collision_rect.y,
self.game.perso.last_coll_y)
destination = boundaries.find('destination')[0]
dest_filename = destination.properties['destination']
(dx, dy) = self.__calcule_delta(self.game.perso, destination)
self.game.perso.move(dx, dy)
self.game.tmx_stackCollisionEvents(self.game.perso,
self.game.tmxEvents)
self.game.tmx_manageCollisionEvents(self.game.perso,
self.game.tmxEvents)
TestCase.assertEquals(self,
self.game.tilemap.filename,
dest_filename)
示例2: test_effectuer_transition
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEquals [as 别名]
def test_effectuer_transition(self):
dest = self.game.tilemap.layers['boundaries'].find('destination')[0]
dest_filename = dest.properties['destination']
self.game.effectuer_transition(dest)
TestCase.assertEquals(self,
self.game.tilemap.filename,
dest_filename)
示例3: goto
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEquals [as 别名]
def goto(level,button=None):
if button is None or (level not in (0,1,2,3) :
return 0
return int(button) - level
from unittest import TestCase
Test = TestCase()
Test.ass
Test.assertEquals(goto(0,'2'),2);
Test.assertEquals(3+goto(3,'1'),1);
Test.assertEquals(2+goto(2,'2'),2);
示例4: assertEquals
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEquals [as 别名]
def assertEquals(self, *args, **kwargs):
raise DeprecationWarning(
'The {0}() function is deprecated. Please start using {1}() '
'instead.'.format('assertEquals', 'assertEqual')
)
return _TestCase.assertEquals(self, *args, **kwargs)
示例5: union
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEquals [as 别名]
(b_end >= a_start and b_end <= a_end)
def union((a_start, a_end), (b_start, b_end)):
return min(a_start, b_start), max(a_end, b_end)
def interval_insert(myl, interval):
myl = list(myl)
target = None
i = 0
while i < len(myl):
if target is not None and overlaps(myl[i], myl[target]):
myl[target] = union(myl[i], myl[target])
myl.pop(i)
elif target is None and overlaps(myl[i], interval):
target = i
myl[i] = union(myl[i], interval)
i += 1
else:
i += 1
if target is None:
myl.append(interval)
return myl
from unittest import TestCase
test = TestCase()
test.assertEquals(interval_insert([(1,2)], (3,4)), [(1, 2), (3, 4)])
test.assertEquals(interval_insert([(3,4)], (1,2)), [(1, 2), (3, 4)])
# test.assertEquals(interval_insert([(1,2), (3, 4)], (2,3)), [(1, 4)])
# test.assertEquals(interval_insert([(1,2), (3, 4), (5, 6)], (2,3)), [(1, 4), (5, 6)])
示例6: group_check
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEquals [as 别名]
def group_check(s):
pat = "(\(\)|\[\]|\{\})"
while re.search(pat, s):
s = re.sub(pat, "", s)
return len(s) < 1
def group_check(s):
stack = []
adict = {"(": ")", "[": "]", "{": "}"}
for character in s:
if stack == [] or character in adict:
stack.append(character)
top = stack[-1]
if top in adict:
if adict[top] == character:
stack.pop()
if stack == []:
return True
return False
from unittest import TestCase
Test = TestCase()
Test.assertEquals(group_check("()"), True)
Test.assertEquals(group_check("({"), False)
示例7: test_addClockSec
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEquals [as 别名]
def test_addClockSec(self):
self.game.addClockSec("playerHud", 1)
TestCase.assertEquals(self,
self.game.clocks["playerHud"],
1 * self.game.FPS)
示例8: build_reads_to_overlap_edges_map
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEquals [as 别名]
reads_to_edges_map, overlap_length_dict, max_overlap_length = \
build_reads_to_overlap_edges_map(kmers_to_reads, uids_to_reads, num_read_uids, k)
# TODO: implement iterative lowering of an overlap length lower bound (say 50, 40, 30)
while max_overlap_length >= k:
r_uid, s_uid = merge_most_overlapping_reads(overlap_length_dict, max_overlap_length,
num_read_uids, uids_to_reads)
num_read_uids += 1
remove_merged_reads(uids_to_reads, r_uid, s_uid)
merged_read_uid = num_read_uids - 1
max_overlap_length = \
update_edge_maps_and_max_overlap(reads_to_edges_map, overlap_length_dict,
max_overlap_length, r_uid, s_uid, merged_read_uid, k, uids_to_reads)
reads, qualities = read_fastq('ads1_week4_reads.fq')
reads = list(set(reads)) # remove duplicates - 14 duplicates
test = TestCase()
start = clock()
test.assertEquals(greedy_scs(reads), 15894)
elapsed = clock() - start
print 'time: %f' % elapsed
示例9: rotate_in_place
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import assertEquals [as 别名]
# modify and return the original matrix rotated 90 degrees clockwise in place
def rotate_in_place(matrix):
return [[row[i] for row in reversed(matrix)] for i in range(len(matrix))]
matrix2 = [[1, 2],
[3, 4]]
print(rotate_in_place(matrix2))
from unittest import TestCase
Test = TestCase()
# Test.describe("rotate_in_place")
matrix2 = [[1, 2],
[3, 4]]
rmatrix2 = [[3, 1],
[4, 2]]
# Test.it("should return the rotated matrices")
Test.assertEquals(rotate_in_place(matrix2), rmatrix2)