Example #1
0
 def __init__(self, data: vdf.VDFDict, fs: VMFFileSystem):
     super().__init__(data, fs)
     dict_solids = data.get_all_for("solid")
     self.solids: List[VMFSolid] = list()
     for solid in dict_solids:
         if not isinstance(solid, vdf.VDFDict):
             continue
         self.solids.append(
             self._parse_custom(VMFSolid, "solid", solid, self.fs))
Example #2
0
 def __init__(self, data: vdf.VDFDict, fs: VMFFileSystem):
     self.fs = fs
     """File system for opening game files."""
     self.id = self._parse_int_str("id", data)
     """A unique value among other solids' IDs."""
     self._context = f"(id {self.id})"
     dict_sides = data.get_all_for("side")
     self.sides: List[VMFSide] = list()
     for side in dict_sides:
         side = self._check_dict("side", side)
         self.sides.append(
             self._parse_custom(VMFSide, "side", side, self.fs))
Example #3
0
 def test_get_all_for_invalid_key(self):
     a = VDFDict()
     with self.assertRaises(TypeError):
         a.get_all_for(None)
     with self.assertRaises(TypeError):
         a.get_all_for(5)
     with self.assertRaises(TypeError):
         a.get_all_for((0, '5'))
Example #4
0
 def test_get_all_for_invalid_key(self):
     a = VDFDict()
     with self.assertRaises(TypeError):
         a.get_all_for(None)
     with self.assertRaises(TypeError):
         a.get_all_for(5)
     with self.assertRaises(TypeError):
         a.get_all_for((0, '5'))
Example #5
0
 def test_get_all_for(self):
     a = VDFDict([("1", 2), ("1", 2**31), ("5", 3), ("1", 2)])
     self.assertEqual(
         list(a.get_all_for("1")),
         [2, 2**31, 2],
     )
Example #6
0
 def test_get_all_for(self):
     a = VDFDict([("1",2),("1",2**31),("5",3),("1",2)])
     self.assertEqual(
         list(a.get_all_for("1")),
         [2,2**31,2],
         )