Exemplo n.º 1
0
 def test_adjacency(self):
     """
     Test of adjacency, from sample seating chart.
     """
     seats = SeatingChart('data/test-seats-complex.csv')
     self.assertEqual({"*****@*****.**", "*****@*****.**"},
                      set(
                          seats.adjacent_to("*****@*****.**",
                                            AdjacencyType.all_ways)))
     self.assertEqual(
         {"*****@*****.**", "*****@*****.**", "*****@*****.**"},
         set(seats.adjacent_to("*****@*****.**", AdjacencyType.all_ways)))
     self.assertEqual(
         set(),
         set(seats.adjacent_to("*****@*****.**", AdjacencyType.all_ways)),
         "Nothing adjacent to something in a different room")
Exemplo n.º 2
0
 def test_column_normalization(self):
     """
     Makes sure that column normalization is carried out on a per-room basis.
     """
     seats = SeatingChart('data/test-seats-multiroom.csv')
     self.assertEqual({"*****@*****.**", "*****@*****.**"},
                      set(
                          seats.adjacent_to("*****@*****.**",
                                            AdjacencyType.all_ways)))
     self.assertEqual(
         {"*****@*****.**", "*****@*****.**", "*****@*****.**"},
         set(seats.adjacent_to("*****@*****.**", AdjacencyType.all_ways)))
     self.assertEqual({"*****@*****.**", "*****@*****.**"},
                      set(
                          seats.adjacent_to("*****@*****.**",
                                            AdjacencyType.all_ways)))
     # pylint: disable=W0212
     self.assertEqual(0.5,
                      seats._location("*****@*****.**").column.location)