Пример #1
0
def test_documentation():
    assert roman("II") == 2
    assert roman("IV") == 4
    assert roman("IX") == 9
    assert roman("XIX") == 19
    assert roman("XX") == 20
    assert roman("MDCCLXXVI") == 1776
    assert roman("MMXIX") == 2019
Пример #2
0
def test_four_nine_numbers():
    assert roman('XLIX') == 49
    assert roman('XL') == 40
    assert roman('XCIX') == 99
    assert roman('XC') == 90
    assert roman('XCIV') == 94
    assert roman('CDXCIX') == 499
    assert roman('CMXCIX') == 999
Пример #3
0
def test_up_to_ten():
    assert roman('I') == 1
    assert roman('III') == 3
    assert roman('V') == 5
    assert roman('VI') == 6
    assert roman('VII') == 7
    assert roman('VIII') == 8
    assert roman('X') == 10
Пример #4
0
def test_single_characters():
    assert roman("I") == 1
    assert roman("V") == 5
    assert roman("X") == 10
    assert roman("L") == 50
    assert roman("C") == 100
    assert roman("M") == 1000
Пример #5
0
from roman import roman

assert roman(1) == 'I'
assert roman(4) == 'IV'  # and not 'IIII'
assert roman(5) == 'V'
assert roman(9) == 'IX'
assert roman(10) == 'X'  # and not VV
 def converts1(self):
     eq_(roman(1), 'I')
Пример #7
0
def test_roundtrip_XLIX():
    assert_equals(roman(arabic('XLIX')), 'XLIX')
Пример #8
0
	def test_one(self):
		self.assertEqual(roman(1), 'I')
Пример #9
0
 def test_twenty(self):
     self.assertEquals("XX", roman(20))
Пример #10
0
 def test_ninety(self):
     self.assertEquals("XC", roman(90))
Пример #11
0
def test_roman_49():
    assert_equals(roman(49), 'XLIX')
Пример #12
0
def test_roman_50():
    assert_equals(roman(50), 'L')
Пример #13
0
def test_roman_44():
    assert_equals(roman(44), 'XLIV')
Пример #14
0
def test_roman_99():
    assert_equals(roman(99), 'XCIX')
Пример #15
0
def test_roman_9():
    assert_equals(roman(9), "IX")
Пример #16
0
def test_roman_4():
    assert_equals(roman(4), "IV")
Пример #17
0
def test_roman_1510():
    assert_equals(roman(1510), "MDX")
Пример #18
0
def test_roman_0():
    assert_equals(roman(0), "")
Пример #19
0
def test_roman_34():
    assert_equals(roman(34), 'XXXIV')
Пример #20
0
 def test_four(self):
     self.assertEquals("IV", roman(4))
Пример #21
0
def test_roman_39():
    assert_equals(roman(39), 'XXXIX')
Пример #22
0
 def test_fourteen(self):
     self.assertEquals("XIV", roman(14))
Пример #23
0
def test_roman_1999():
    assert_equals(roman(1999), 'MCMXCIX')
Пример #24
0
 def test_fifty(self):
     self.assertEquals("L", roman(50))
Пример #25
0
def test_roman_1499():
    assert_equals(roman(1499), 'MCDXCIX')
Пример #26
0
 def test_two_hundred(self):
     self.assertEquals("CC", roman(200))
Пример #27
0
def test_roundtrip():
    assert_equals(arabic(roman(1)), 1)
Пример #28
0
def make_item(bonus_count = 4, level = 0):
	col = random.randint(0,len(column_type_name)-1)
	row = random.randint(0,7)

	effect_number = random.randint(0,len(Effect)-1)

	name = column_type_name[col]
	if(bonus_count > 4):
		name = Effect[effect_number] + " " + column_type_name[col]

	negatives = 1
	item_unit = None

	if(bonus_count > 4):
		attr = Effect_Attrib[Effect[effect_number]]
		item_unit = Ability(bonus_count-1,negatives,(name,effect_number),force_power=attr).unit

	else:

		item_unit = Ability(bonus_count,negatives,(name,effect_number)).unit

	item_unit.level_up(level)
	item_unit.clear_bonus()
	bonus_count = item_unit.attrib_count()

	unit_title_name = (item_unit.output_attribs()).split("\n",1)
	string_to_print = ""

	if(len(unit_title_name)>1):
		unit_title_name = "".join(re.split("\(|\)",unit_title_name[1])[0::2])
		if(bonus_count > 2):
			attr = item_unit.random_attrib()
			if((col == 19 or col == 20)):
				name = name[:-6]+random.choice(("cuirass", "plate", "outfit"))
			if(attr == "armour" or attr == "dodge_chance"):
				name += random.choice((" of Protection"," of Defense"," of Defiance"))
			else:
				name += " of " + attr
		else:
			name = random.choice(("Worn", "Old", "Musty", "Bent", "Cracked"))+" "+name
		name = name.replace("_"," ").title()
		if(level > 0):
			name += " " + str(roman(level))

		string_to_print = (name+"\n"+unit_title_name.replace("_"," ").title())
	else:
		name = name.title()
		if(level > 0):
			name += " " + str(roman(level))
		string_to_print = name

	icon = globals.icons_items.image_by_coords(60,col,row)
	icon.blit(globals.icons_items_outlines, (0,0),   (60*(3-(bonus_count+1)/2), 0, 60, 60))
	icon.blit(globals.icons_items_outlines, (2,2),   (60*(3-(bonus_count+1)/2), 0, 60, 60))
	icon.blit(globals.icons_items_outlines, (-2,-2), (60*(3-(bonus_count+1)/2), 0, 60, 60))
	icon.blit(globals.icons_items_outlines, (-2,2),  (60*(3-(bonus_count+1)/2), 0, 60, 60))
	icon.blit(globals.icons_items_outlines, (2,-2),  (60*(3-(bonus_count+1)/2), 0, 60, 60))
	icon.convert()
	#pygame.image.save(icon,"Saved Games/0/Items/"+name+".png")
	#write_file("Saved Games/0/Items/"+name+".pkl",item_unit)

	ret = (name, item_unit, icon, item_unit.attrib_count(), int(max(max(item_unit.m_level,0.5) * item_unit.attrib_count() * item_unit.attrib_count() * 10, 13)*random.uniform(0.7,1.3)), string_to_print)
	#has to be reset for the next item
	bonus_count = 4
	return ret
Пример #29
0
def test_roman_1():
    assert_equals(roman(1), 'I')
Пример #30
0
	def test_two(self):
		self.assertEqual(roman(2), 'II')
 def converts6(self):
     eq_(roman(6), 'VI')
Пример #32
0
import sys
from roman import roman

if __name__ == '__main__':
	print(roman('II'))          # 2
	print(roman('IV'))          # 4
	print(roman('IX'))          # 9
	print(roman('XIX'))         # 19
	print(roman('XX'))          # 20
	print(roman('MDCCLXXVI'))   # 1776
	print(roman('MMXIX'))       # 2019
	

    
    
    
Пример #33
0
 def test_two(self):
     self.assertEquals("II", roman(2))
 def converts2(self):
     eq_(roman(2), 'II')
Пример #35
0
def test_roman_110():
    assert_equals(roman(110), 'CX')
 def test_converts(self, arabic, expected_roman):
     eq_(roman(arabic), expected_roman)
Пример #37
0
 def test_six(self):
     self.assertEquals("VI", roman(6))
Пример #38
0
 def test_three(self):
     self.assertEquals("III", roman(3))
Пример #39
0
 def test_nine(self):
     self.assertEquals("IX", roman(9))
Пример #40
0
 def test_five(self):
     self.assertEquals("V", roman(5))
Пример #41
0
def test_roman_10():
    assert_equals(roman(10), 'X')
Пример #42
0
 def test_seven(self):
     self.assertEquals("VII", roman(7))
Пример #43
0
def test_19():
    assert roman("XIX") == 19
Пример #44
0
 def test_ten(self):
     self.assertEquals("X", roman(10))
Пример #45
0
def test_20():
    assert roman("XX") == 20
Пример #46
0
 def test_nineteen(self):
     self.assertEquals("XIX", roman(19))
Пример #47
0
def test_1776():
    assert roman("MDCCLXXVI") == 1776
Пример #48
0
 def test_fourty(self):
     self.assertEquals("XL", roman(40))
Пример #49
0
def test_2019():
    assert roman("MMXIX") == 2019
Пример #50
0
 def test_zero(self):
     self.assertEquals("", roman(0))
Пример #51
0
def test_3_in_row():
    assert roman("CXXX") == 130
Пример #52
0
 def test_one_hundred(self):
     self.assertEquals("C", roman(100))
Пример #53
0
def test_8():
    assert roman("VIII") == 8
Пример #54
0
 def test_one(self):
     self.assertEquals("I", roman(1))
Пример #55
0
def test_roman_5():
    assert_equals(roman(5), 'V')