Beispiel #1
0
	def testHexToTupleLeadingZeros(self):
		"""testing colorTupleFromHex(number) = colorTupleFromHex('00'+number)"""
		number = "0A0CFF"
		result = dColors.colorTupleFromHex(number)
		zeroResult = dColors.colorTupleFromHex("000" + number)
		self.assertEqual(result, zeroResult)
Beispiel #2
0
	def testSanity(self):
		"""tuple = tupleToHex(colorTupleFromHex(tuple)) for range of valid input values"""
		#All inputs was way too many
		for run in range(1000):
			a, b, c = random.choice(range(256)), random.choice(range(256)), random.choice(range(256))
			self.assertEqual((a,b,c), dColors.colorTupleFromHex(dColors.tupleToHex((a,b,c))))
Beispiel #3
0
	def testHexToTupleCaseInsensitive(self):
		"""colorTupleFromHex should accept and give same result for both upper and lowercase input"""
		lower = dColors.colorTupleFromHex("abcdef123")
		upper = dColors.colorTupleFromHex("ABCDEF123")
		self.assertEqual(lower, upper)
Beispiel #4
0
	def testKnownValuesHexToTuple(self):
		"""colorTupleFromHex should give known result with known input"""
		for hex, tuple in self.knownValues:
			result = dColors.colorTupleFromHex(hex)
			self.assertEqual(result, tuple)