Пример #1
0
 def test_Commands_desc_line_has_trailing_whitespace(self):
     filepath = os.path.join(
         __dirname__, "test_commands_txts",
         inspect.stack()[0][3].replace("test_", "") + ".txt")
     result = xplane_commands_txt_parser.parse_commands_txt(filepath)
     #print(result)
     self.assertTrue("cannot end with whitespace" in result)
Пример #2
0
 def test_Commands_empty_file(self):
     filepath = os.path.join(
         __dirname__, "test_commands_txts",
         inspect.stack()[0][3].replace("test_", "") + ".txt")
     result = xplane_commands_txt_parser.parse_commands_txt(filepath)
     #print(result)
     self.assertTrue("has no commands in it" in result)
Пример #3
0
 def test_Commands_line_starts_with_whitespace(self):
     filepath = os.path.join(
         __dirname__, "test_commands_txts",
         inspect.stack()[0][3].replace("test_", "") + ".txt")
     result = xplane_commands_txt_parser.parse_commands_txt(filepath)
     #print(result)
     self.assertTrue("cannot start with whitespace or be empty" in result)
Пример #4
0
 def test_Commands_empty_line(self):
     filepath = os.path.join(
         __dirname__, "test_commands_txts",
         inspect.stack()[0][3].replace("test_", "") + ".txt")
     result = xplane_commands_txt_parser.parse_commands_txt(filepath)
     #print(result)
     self.assertEqual(len(result), 2)
Пример #5
0
 def test_Commands_missing(self):
     result = xplane_commands_txt_parser.parse_commands_txt(
         os.path.join(__dirname__, "test_commands_txts",
                      "Commands_missing.txt"))
     #print(result)
     self.assertEqual(
         "No such file or directory", result
     )  #This comes from Exception's message when the file is missing
Пример #6
0
 def test_Commands_no_description_passes(self):
     #Tests if ``sim/mycommand`` without whitespace and description,
     #because the one in resources has a description for all of them
     filepath = os.path.join(__dirname__, "test_commands_txts", inspect.stack()[0][3].replace("test_", "") + ".txt")
     result = xplane_commands_txt_parser.parse_commands_txt(filepath)
     #print(result)
     #3 because it could be easy to it work once on accident
     self.assertEqual(len(result),3) 
Пример #7
0
 def test_Commands_no_description_passes(self):
     #Tests if ``sim/mycommand`` without whitespace and description,
     #because the one in resources has a description for all of them
     filepath = os.path.join(
         __dirname__, "test_commands_txts",
         inspect.stack()[0][3].replace("test_", "") + ".txt")
     result = xplane_commands_txt_parser.parse_commands_txt(filepath)
     #print(result)
     #3 because it could be easy to it work once on accident
     self.assertEqual(len(result), 3)
Пример #8
0
 def test_Commands_in_resource_passes(self):
     #We should be able to parse the Commands.txt we ship with!
     #Tests that resource and our code.
     
     result = xplane_commands_txt_parser.parse_commands_txt(
         os.path.join(__dirname__, "..", "..", "io_xplane2blender", "resources", "Commands.txt"))
     #print(result)
     self.assertIsInstance(result, list)
     # Anytime we update Commands.txt we'll update this number.
     # A little annoying? Sure, but we'll get it exactly right
     self.assertEqual(len(result), 1914)
Пример #9
0
    def test_Commands_in_resource_passes(self):
        #We should be able to parse the Commands.txt we ship with!
        #Tests that resource and our code.

        result = xplane_commands_txt_parser.parse_commands_txt(
            os.path.join(__dirname__, "..", "..", "io_xplane2blender",
                         "resources", "Commands.txt"))
        #print(result)
        self.assertIsInstance(result, list)
        # Anytime we update Commands.txt we'll update this number.
        # A little annoying? Sure, but we'll get it exactly right
        self.assertEqual(len(result), 1914)
Пример #10
0
 def test_Commands_missing(self):
     result = xplane_commands_txt_parser.parse_commands_txt(
         os.path.join(__dirname__, "test_commands_txts", "Commands_missing.txt"))
     #print(result)
     self.assertEqual("No such file or directory", result) #This comes from Exception's message when the file is missing
Пример #11
0
 def test_Commands_desc_line_has_trailing_whitespace(self):
     filepath = os.path.join(__dirname__, "test_commands_txts",  inspect.stack()[0][3].replace("test_", "") + ".txt")
     result = xplane_commands_txt_parser.parse_commands_txt(filepath)
     #print(result)
     self.assertTrue("cannot end with whitespace" in result)
Пример #12
0
 def test_Commands_line_starts_with_whitespace(self):
     filepath = os.path.join(__dirname__, "test_commands_txts",  inspect.stack()[0][3].replace("test_", "") + ".txt")
     result = xplane_commands_txt_parser.parse_commands_txt(filepath)
     #print(result)
     self.assertTrue("cannot start with whitespace or be empty" in result)
Пример #13
0
 def test_Commands_empty_file(self):
     filepath = os.path.join(__dirname__, "test_commands_txts",  inspect.stack()[0][3].replace("test_", "") + ".txt")
     result = xplane_commands_txt_parser.parse_commands_txt(filepath)
     #print(result)
     self.assertTrue("has no commands in it" in result)
Пример #14
0
 def test_Commands_empty_line(self):
     filepath = os.path.join(__dirname__, "test_commands_txts",  inspect.stack()[0][3].replace("test_", "") + ".txt")
     result = xplane_commands_txt_parser.parse_commands_txt(filepath)
     #print(result)
     self.assertEqual(len(result),2)