Пример #1
0
    def test_floor_encoding_and_decoding(self):
        p2 = Polygon.from_absolute_coordinates([(12, 0), (22, 0), (22, 10), (12, 10)])
        r2 = Room(p2)
        f1 = Floor("Building cool name", "Floor cool name", [self.room1, r2])

        f_dump = json.dumps(f1.to_serializable())
        f_load = json.loads(f_dump)

        f2 = Floor.from_serializable(f_load)

        self.assertEqual(f1, f2)
Пример #2
0
   def test_floor_encoding_and_decoding(self):
      p2 = Polygon.from_absolute_coordinates([(12,0),(22,0),(22,10),(12,10)])
      r2 = Room(p2)
      f1 = Floor("Building cool name","Floor cool name", [self.room1,r2])

      f_dump = json.dumps(f1.to_serializable())
      f_load = json.loads(f_dump)

      f2 = Floor.from_serializable(f_load)

      self.assertEqual(f1,f2)
Пример #3
0
   def test_floor_to_serializable(self):
      p2 = Polygon.from_absolute_coordinates([(12,0),(22,0),(22,10),(12,10)])
      r2 = Room(p2)
      f  = Floor("Building cool name","Floor cool name", [self.room1, r2])

      self.assertEqual( f.to_serializable() ,
         {
            "walls"     : [],
            "windows"   : [],
            "b_id"      : f.b_id,
            "f_id"      : f.f_id,
            "rooms"     : [self.room1.to_serializable(), r2.to_serializable()]
         })
Пример #4
0
    def test_floor_to_serializable(self):
        p2 = Polygon.from_absolute_coordinates([(12, 0), (22, 0), (22, 10), (12, 10)])
        r2 = Room(p2)
        f = Floor("Building cool name", "Floor cool name", [self.room1, r2])

        self.assertEqual(
            f.to_serializable(),
            {
                "walls": [],
                "windows": [],
                "b_id": f.b_id,
                "f_id": f.f_id,
                "rooms": [self.room1.to_serializable(), r2.to_serializable()],
            },
        )