Пример #1
0
 def test_DataRefs_missing(self):
     result = xplane_datarefs_txt_parser.parse_datarefs_txt(os.path.join(__dirname__,"test_datarefs_txts","DataRefs_missing.txt"))
     #print(result)
     self.assertEqual("No such file or directory",result) #This comes from Exception's message when the file is missing
Пример #2
0
 def test_DataRefs_no_blank_second_line(self):
     filepath = os.path.join(__dirname__,"test_datarefs_txts", inspect.stack()[0][3].replace("test_","") + ".txt")
     result = xplane_datarefs_txt_parser.parse_datarefs_txt(filepath)
     #print(result)
     self.assertTrue("Does not have a blank line for its second line" in result)
Пример #3
0
 def test_DataRefs_no_datarefs_in_it(self):
     filepath = os.path.join(__dirname__,"test_datarefs_txts", inspect.stack()[0][3].replace("test_","") + ".txt")
     result = xplane_datarefs_txt_parser.parse_datarefs_txt(filepath)
     #print(result)
     self.assertTrue("File has no datarefs in it" in result)
Пример #4
0
 def test_DataRefs_invalid_type_wrong(self):
     filepath = os.path.join(__dirname__,"test_datarefs_txts", inspect.stack()[0][3].replace("test_","") + ".txt")
     result = xplane_datarefs_txt_parser.parse_datarefs_txt(filepath)
     #print(result)
     self.assertTrue("must be an int, float, double, or byte" in result)
Пример #5
0
 def test_DataRefs_line_starts_with_whitespace(self):
     filepath = os.path.join(__dirname__,"test_datarefs_txts", inspect.stack()[0][3].replace("test_","") + ".txt")
     result = xplane_datarefs_txt_parser.parse_datarefs_txt(filepath)
     #print(result)
     self.assertTrue("cannot start with whitespace" in result)
Пример #6
0
 def test_DataRefs_invalid_iswritable(self):
     filepath = os.path.join(__dirname__,"test_datarefs_txts", inspect.stack()[0][3].replace("test_","") + ".txt")
     result = xplane_datarefs_txt_parser.parse_datarefs_txt(filepath)
     #print(result)
     self.assertTrue("must be 'y' or 'n'" in result)
Пример #7
0
 def test_DataRefs_invalid_array_type_index_wrong(self):
     filepath = os.path.join(__dirname__,"test_datarefs_txts", inspect.stack()[0][3].replace("test_","") + ".txt")
     result = xplane_datarefs_txt_parser.parse_datarefs_txt(filepath)
     #print(result)
     self.assertTrue("must be one or more digits" in result)
Пример #8
0
 def test_DataRefs_invalid_array_type(self):
     filepath = os.path.join(__dirname__,"test_datarefs_txts", inspect.stack()[0][3].replace("test_","") + ".txt")
     result = xplane_datarefs_txt_parser.parse_datarefs_txt(filepath)
     #print(result)
     self.assertTrue("must be formatted as 'datatype[index]', where datatype is a valid type and index is one or more digits" in result)
Пример #9
0
 def test_DataRefs_header_xp_version_is_wrong(self):
     filepath = os.path.join(__dirname__,"test_datarefs_txts", inspect.stack()[0][3].replace("test_","") + ".txt")
     result = xplane_datarefs_txt_parser.parse_datarefs_txt(filepath)
     #print(result)
     self.assertTrue("File format line is invalid" in result)
Пример #10
0
 def test_DataRefs_header_file_version_is_one(self):
     filepath = os.path.join(__dirname__,"test_datarefs_txts", inspect.stack()[0][3].replace("test_","") + ".txt")
     result = xplane_datarefs_txt_parser.parse_datarefs_txt(filepath)
     #print(result)
     self.assertTrue("File version number" in result)