def test7_get_year_to(self): """ Testing get_name """ self.assertEqual(Building.get_year_to(Building, 0), 0) self.assertEqual(Building.get_year_to(Building, 1), 438) self.assertEqual(Building.get_year_to(Building, 2), None) self.assertRaises(Building.DoesNotExist, Building.get_year_to, Building, 3)
def test5_get_year_from(self): """ Testing get_name """ self.assertEqual(Building.get_year_from(Building, 0), 0) self.assertEqual(Building.get_year_from(Building, 1), 447) self.assertEqual(Building.get_year_from(Building, 2), None) self.assertRaises(Building.DoesNotExist, Building.get_year_from, Building, 3)
def test4_get_country(self): """ Testing get_name """ self.assertEqual(Building.get_country(Building, 0), '') self.assertEqual(Building.get_country(Building, 1), 'GR-Griechenland') self.assertEqual(Building.get_country(Building, 2), 'Griechenland') self.assertRaises(Building.DoesNotExist, Building.get_country, Building, 3)
def test3_get_region(self): """ Testing get_name """ self.assertEqual(Building.get_region(Building, 0), '') self.assertEqual(Building.get_region(Building, 1), 'TestRegion') self.assertEqual(Building.get_region(Building, 2), None) self.assertRaises(Building.DoesNotExist, Building.get_region, Building, 3)
def test8_get_year_to_BC_or_AD(self): """ Testing get_name """ self.assertEqual(Building.get_year_to_bc_or_ad(Building, 0), '') self.assertEqual(Building.get_year_to_bc_or_ad(Building, 1), 'v.Chr.') self.assertEqual(Building.get_year_to_bc_or_ad(Building, 2), 'v.Chr.') self.assertRaises(Building.DoesNotExist, Building.get_year_to_bc_or_ad, Building, 3)
def test15_get_length(self): """ Testing get_name """ self.assertEqual(Building.get_length(Building, 0), 0) self.assertEqual(Building.get_length(Building, 1), 30.88) self.assertEqual(Building.get_length(Building, 2), None) self.assertRaises(Building.DoesNotExist, Building.get_length, Building, 3)
def test1_get_name(self): """ Testing get_name """ self.assertEqual(Building.get_name(Building, 0), '') self.assertEqual(Building.get_name(Building, 1), 'Parthenon') self.assertEqual(Building.get_name(Building, 2), 'empty') self.assertRaises(Building.DoesNotExist, Building.get_name, Building, 3)
def test28_get_year_century(self): """ Testing get_date_ca """ self.assertEqual(Building.get_year_century(Building, 0), False) self.assertEqual(Building.get_year_century(Building, 1), True) self.assertEqual(Building.get_year_century(Building, 2), False) self.assertRaises(Building.DoesNotExist, Building.get_year_century, Building, 3)
def test21_get_construction(self): """ Testing get_name """ self.assertEqual(Building.get_construction(Building, 0), '') self.assertEqual(Building.get_construction(Building, 1), 'Massivbau') self.assertEqual(Building.get_construction(Building, 2), None) self.assertRaises(Building.DoesNotExist, Building.get_construction, Building, 3)
def test19_get_area(self): """ Testing get_name """ self.assertEqual(Building.get_area(Building, 0), 0) self.assertEqual(Building.get_area(Building, 1), 1) self.assertEqual(Building.get_area(Building, 2), None) self.assertRaises(Building.DoesNotExist, Building.get_area, Building, 3)
def test10_get_context(self): """ Testing get_name """ self.assertEqual(Building.get_context(Building, 0), '') self.assertEqual(Building.get_context(Building, 1), 'Tempel') self.assertEqual(Building.get_context(Building, 2), None) self.assertRaises(Building.DoesNotExist, Building.get_context, Building, 3)
def test16_get_width(self): """ Testing get_name """ self.assertEqual(Building.get_width(Building, 0), 0) self.assertEqual(Building.get_width(Building, 1), 69.5) self.assertEqual(Building.get_width(Building, 2), None) self.assertRaises(Building.DoesNotExist, Building.get_width, Building, 3)
def test18_get_circumference(self): """ Testing get_name """ self.assertEqual(Building.get_circumference(Building, 0), 0) self.assertEqual(Building.get_circumference(Building, 1), 1) self.assertEqual(Building.get_circumference(Building, 2), None) self.assertRaises(Building.DoesNotExist, Building.get_circumference, Building, 3)
def test14_get_function(self): """ Testing get_name """ self.assertEqual(Building.get_function(Building, 0), '') self.assertEqual(Building.get_function(Building, 1), 'Sakralbau') self.assertEqual(Building.get_function(Building, 2), None) self.assertRaises(Building.DoesNotExist, Building.get_function, Building, 3)
def test2_get_city(self): """ Testing get_name """ self.assertEqual(Building.get_city(Building, 0), '') self.assertEqual(Building.get_city(Building, 1), 'Athen') self.assertEqual(Building.get_city(Building, 2), None) self.assertRaises(Building.DoesNotExist, Building.get_city, Building, 3)
def test13_get_design(self): """ Testing get_name """ self.assertEqual(Building.get_design(Building, 0), '') self.assertEqual(Building.get_design(Building, 1), 'Peripteros') self.assertEqual(Building.get_design(Building, 2), None) self.assertRaises(Building.DoesNotExist, Building.get_design, Building, 3)
def test12_get_construction_type(self): """ Testing get_name """ self.assertEqual(Building.get_construction_type(Building, 0), '') self.assertEqual(Building.get_construction_type(Building, 1), 'Tempel') self.assertEqual(Building.get_construction_type(Building, 2), None) self.assertRaises(Building.DoesNotExist, Building.get_construction_type, Building, 3)
def test25_get_year_ca(self): """ Testing get_year_ca """ self.assertEqual(Building.get_year_ca(Building, 0), False) self.assertEqual(Building.get_year_ca(Building, 1), True) self.assertEqual(Building.get_year_ca(Building, 2), False) self.assertRaises(Building.DoesNotExist, Building.get_year_ca, Building, 3)
def test24_get_description(self): """ Testing get_description """ self.assertEqual(Building.get_description(Building, 0), '') self.assertEqual(Building.get_description(Building, 1), 'Das Parthenon in Athen') self.assertEqual(Building.get_description(Building, 2), None) self.assertRaises(Building.DoesNotExist, Building.get_description, Building, 3)
def test22_get_material(self): """ Testing get_name """ self.assertEqual(Building.get_material(Building, 0), '') self.assertEqual(Building.get_material(Building, 1), 'penetelischer Marmor') self.assertEqual(Building.get_material(Building, 2), None) self.assertRaises(Building.DoesNotExist, Building.get_material, Building, 3)
def test11_get_builder(self): """ Testing get_name """ self.assertEqual(Building.get_builder(Building, 0), '') self.assertEqual(Building.get_builder(Building, 1), 'Perikles und die Polis Athen') self.assertEqual(Building.get_builder(Building, 2), None) self.assertRaises(Building.DoesNotExist, Building.get_builder, Building, 3)
def test20_get_column_order(self): """ Testing get_name """ self.assertEqual(Building.get_column_order(Building, 0), '') self.assertEqual(Building.get_column_order(Building, 1), 'dorisch, ionischer Fries') self.assertEqual(Building.get_column_order(Building, 2), None) self.assertRaises(Building.DoesNotExist, Building.get_column_order, Building, 3)
def test9_get_architect(self): """ Testing get_name """ self.assertEqual(Building.get_architect(Building, 0), '') self.assertEqual(Building.get_architect(Building, 1), 'Iktinos, Kallikrates') self.assertEqual(Building.get_architect(Building, 2), None) self.assertRaises(Building.DoesNotExist, Building.get_architect, Building, 3)
def test27_get_links(self): """ Testing get_name """ self.assertEqual(Building.get_links(Building, 0), list('')) self.assertEqual( Building.get_links(Building, 1), ["www.tu-darmstadt.de", "www.architektur.tu-darmstadt.de"]) self.assertEqual(Building.get_links(Building, 2), list('')) self.assertRaises(Building.DoesNotExist, Building.get_name, Building, 3)
def test23_get_literature(self): """ Testing get_name """ self.assertEqual(Building.get_literature(Building, 0), '') self.assertEqual( Building.get_literature(Building, 1), 'Muss - Schubert 1988, SEITEN?; Gruben 2001, 173-190; Hellmann 2006, ' '82-96;') self.assertEqual(Building.get_literature(Building, 2), None) self.assertRaises(Building.DoesNotExist, Building.get_name, Building, 3)
def test_get_year_as_str(self): """ testing the model function get_year_as_str in the building model """ # No years at all building1 = Building(name='Building1') self.assertEqual(building1.get_year_as_str(), '') # Only year_from without year_from_BC_or_AD building2 = Building(name='Building2', year_from=100) self.assertEqual(building2.get_year_as_str(), '100 v.Chr.') # with year_from_BC_or_AD building2.year_from_BC_or_AD = 'n.Chr.' self.assertEqual(building2.get_year_as_str(), '100 n.Chr.') # Only year_to, year_to_Bc_or_AD doesn't matter building3 = Building(name='building3', year_to=100) self.assertEqual(building3.get_year_as_str(), '') # With year_to and year_from, but year_to_BC_or_AD is null building4 = Building(name='building4', year_from=99, year_to=100, year_from_BC_or_AD='v.Chr.') self.assertEqual(building4.get_year_as_str(), '99 v.Chr. - 100 v.Chr.') # now with year_to_BC_or_AD building4.year_to_BC_or_AD = 'n.Chr.' self.assertEqual(building4.get_year_as_str(), '99 v.Chr. - 100 n.Chr.') # With year_century and ca building5 = Building(name='Building5', year_from=1, year_to=1, year_ca=True, year_century=True, year_from_BC_or_AD='v.Chr.', year_to_BC_or_AD='n.Chr.') self.assertEqual(building5.get_year_as_str(), 'ca. 1. Jh. v.Chr. - ca. 1. Jh. n.Chr.')
def test_get_year_as_signed_int(self): """ Testing the model function get_year_as_signed_int in the building model """ building1 = Building(name='Baum in Ganeshas Garten', year_from=100, year_to=50, year_from_BC_or_AD='v.Chr.', year_to_BC_or_AD='v.Chr.') building2 = Building(name='Baum in Jonathans Garten', year_from=700, year_from_BC_or_AD='v.Chr.', year_to_BC_or_AD='n.Chr.') building3 = Building(name='Nichts') building4 = Building(name='Century', year_from=3, year_to=1, year_century=True, year_from_BC_or_AD='v.Chr.', year_to_BC_or_AD='v.Chr.') building5 = Building(name='Century2', year_from=5, year_from_BC_or_AD='n.Chr.', year_century=True, year_to=6, year_to_BC_or_AD='n.Chr.') # Testing building with no empty fields self.assertEqual(building1.get_year_as_signed_int(), [-100, -50]) building1.year_from_BC_or_AD = building1.year_to_BC_or_AD = 'n.Chr.' self.assertEqual(building1.get_year_as_signed_int(), [100, 50]) # Testing building with year_to is empty self.assertEqual(building2.get_year_as_signed_int(), [-700, 9999]) # and with year_from is empty building2.year_to = 100 building2.year_from = None self.assertEqual(building2.get_year_as_signed_int(), [9999, 100]) # Testing building with only a name self.assertEqual(building3.get_year_as_signed_int(), [9999, 9999]) # Testing Century for buildings self.assertEqual(building4.get_year_as_signed_int(), [-250, -50]) self.assertEqual(building5.get_year_as_signed_int(), [450, 550]) building4.year_to = building4.year_from = building5.year_to = building5.year_from = 0 self.assertEqual(building4.get_year_as_signed_int(), [0, 0]) self.assertEqual(building5.get_year_as_signed_int(), [0, 0])