本文整理匯總了Python中auvsi_suas.models.target.Target.alphanumeric_color方法的典型用法代碼示例。如果您正苦於以下問題:Python Target.alphanumeric_color方法的具體用法?Python Target.alphanumeric_color怎麽用?Python Target.alphanumeric_color使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類auvsi_suas.models.target.Target
的用法示例。
在下文中一共展示了Target.alphanumeric_color方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_similar_classifications
# 需要導入模塊: from auvsi_suas.models.target import Target [as 別名]
# 或者: from auvsi_suas.models.target.Target import alphanumeric_color [as 別名]
def test_similar_classifications(self):
"""Tests similar classification counts are computed correctly."""
# Test equal standard targets.
l = GpsPosition(latitude=38, longitude=-76)
l.save()
t1 = Target(user=self.user,
target_type=TargetType.standard,
location=l,
orientation=Orientation.s,
shape=Shape.square,
background_color=Color.white,
alphanumeric='ABC',
alphanumeric_color=Color.black,
description='Test target',
autonomous=True)
t1.save()
t2 = Target(user=self.user,
target_type=TargetType.standard,
location=l,
orientation=Orientation.s,
shape=Shape.square,
background_color=Color.white,
alphanumeric='ABC',
alphanumeric_color=Color.black,
description='Test other target',
autonomous=True)
t2.save()
self.assertAlmostEqual(1.0, t1.similar_classifications(t2))
# Test unequal standard targets.
t1.alphanumeric = 'DEF'
t1.alphanumeric_color = Color.blue
t1.save()
self.assertAlmostEqual(3.0 / 5.0, t1.similar_classifications(t2))
t1.shape = Shape.circle
t1.background_color = Color.orange
t1.save()
self.assertAlmostEqual(1.0 / 5.0, t1.similar_classifications(t2))
# Test different types.
t1.target_type = TargetType.off_axis
t1.save()
self.assertAlmostEqual(0, t1.similar_classifications(t2))
# Test off_axis is same as standard.
t2.target_type = TargetType.off_axis
t2.alphanumeric = 'DEF'
t2.save()
self.assertAlmostEqual(2.0 / 5.0, t1.similar_classifications(t2))
# Test emergent type is always 1.
t1.target_type = TargetType.emergent
t1.save()
t2.target_type = TargetType.emergent
t2.save()
self.assertAlmostEqual(1.0, t1.similar_classifications(t2))