Skip to content

Commit

Permalink
refactor: migrated tests to pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
kronenthaler committed Oct 11, 2023
1 parent b24ada1 commit 29d9169
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
17 changes: 6 additions & 11 deletions tests/TestParsing.py
Expand Up @@ -28,30 +28,30 @@
from openstep_parser import openstep_parser as osp


class Parsing(unittest.TestCase):
class ParsingTest(unittest.TestCase):
def testParseNestedDictionary(self):
line = '''{ a = { b = b1; }; };'''
result = osp.OpenStepDecoder()._parse_dictionary(line, 0)
assert result

def testParseFileSample1(self):
result = osp.OpenStepDecoder.ParseFromFile(open('tests/samples/music-cube.pbxproj'))
result = osp.OpenStepDecoder.ParseFromFile(open('samples/music-cube.pbxproj'))
assert result

def testParseFileSample2(self):
result = osp.OpenStepDecoder.ParseFromFile(open('tests/samples/cloud-search.pbxproj'))
result = osp.OpenStepDecoder.ParseFromFile(open('samples/cloud-search.pbxproj'))
assert result

def testParseFileSample3(self):
result = osp.OpenStepDecoder.ParseFromFile(open('tests/samples/collection-view.pbxproj'))
result = osp.OpenStepDecoder.ParseFromFile(open('samples/collection-view.pbxproj'))
assert result

def testParseFileSample4(self):
result = osp.OpenStepDecoder.ParseFromFile(open('tests/samples/metal-image-processing.pbxproj'))
result = osp.OpenStepDecoder.ParseFromFile(open('samples/metal-image-processing.pbxproj'))
assert result

def testParseFileSample5(self):
result = osp.OpenStepDecoder.ParseFromFile(open('tests/samples/no_whitespace.pbxproj'))
result = osp.OpenStepDecoder.ParseFromFile(open('samples/no_whitespace.pbxproj'))
assert result

def testIgnoreWhitespacesFromBeginning(self):
Expand Down Expand Up @@ -155,7 +155,6 @@ def testFullDictionaryWithoutEndingSemicolon(self):
assert result['KEY-NAME1'] == 'value-1234'
assert result['KEY-NAME2'] == 'value-5678'


def testArrayEntry(self):
parser = osp.OpenStepDecoder()
line = ' /* some comments */ KEY-NAME /* asd */ , '
Expand Down Expand Up @@ -196,7 +195,3 @@ def testParseWithComment(self):
expected = {}
result = osp.OpenStepDecoder.ParseFromString(line)
assert result == expected


if __name__ == '__main__':
unittest.main()
3 changes: 3 additions & 0 deletions tests/pytest.ini
@@ -0,0 +1,3 @@
[pytest]
python_files = Test*.py
pythonpath = ..

0 comments on commit 29d9169

Please sign in to comment.