Skip to content

added unit-test for functions in buildfiles.py#3635

Merged
alex-jansen merged 3 commits intomainfrom
build_files_cleanup
Sep 27, 2024
Merged

added unit-test for functions in buildfiles.py#3635
alex-jansen merged 3 commits intomainfrom
build_files_cleanup

Conversation

@MatthiasWiesmann
Copy link
Contributor

Added unit-test for functions in buildfiles.py and cleaned up some of the covered functions.

@MatthiasWiesmann MatthiasWiesmann added the python Pull requests that update Python code label Sep 25, 2024

class TestBuildFiles(unittest.TestCase):

def testProtocolSwapEmpty(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that name now does not cover all that is done in the tests though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a header doc, it checks functionality in the relevant module/library.

def testProtocols(self):
self.assertEqual(sorted(buildfiles.protocols()), ['http', 'https'])

def testArrayToStr(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is array2str different from str.join() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's the same, but I'm not 100% sure and I have seen clones around various files.
So I first want to add some tests, and then see if I can get rid of it.

formats = ["json-ld", "turtle", "nt", "nquads", "rdf"]
extype = exportType[len("RDFExport."):]
formats = ["json-ld", "turtle", "nt", "nquads", "rdf"]
extype = exportType[len("RDFExport.") :]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: in the [] I would not add space though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll run ruff on the file, it should fix the formatting.

@alex-jansen alex-jansen merged commit 5d8263c into main Sep 27, 2024
@alex-jansen alex-jansen deleted the build_files_cleanup branch September 27, 2024 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants