Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_green Unit Test Date Format Mismatch #26

Open
jlw387 opened this issue Jul 8, 2024 · 0 comments
Open

test_green Unit Test Date Format Mismatch #26

jlw387 opened this issue Jul 8, 2024 · 0 comments

Comments

@jlw387
Copy link
Collaborator

jlw387 commented Jul 8, 2024

Hello!

I pip installed the library (version 1.0.9 according to pip list), cloned the repository, and ran the unit tests to make sure everything was installed correctly. One of the unit tests failed, and it seems like it is due to a date format mismatch.

Here is the printout I got for the "test_green" unit test (I have omitted some of my local paths with the <...> notation):

======================================================================
FAIL: test_green (tests.test_agilent.TestAgilent.test_green)
Tests a directory containing:
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\<...>\rainbow\tests\test_agilent.py", line 45, in test_green
    self._DataTester__test_data_directory("green", "D")
  File "C:\<...>\rainbow\tests\datatester.py", line 68, in __test_data_directory
    self.assertDictEqual(datadir.metadata, json_data['metadata'])
AssertionError: {'vendor': 'Agilent', 'date': '03-Feb-22, 11:22:20'} != {'vendor': 'Agilent', 'date': '3 Feb 22  11:22 am -0500'}
- {'date': '03-Feb-22, 11:22:20', 'vendor': 'Agilent'}
?           - ^   ^  ^      ^^

+ {'date': '3 Feb 22  11:22 am -0500', 'vendor': 'Agilent'}
?            ^   ^  ^      ^^^^^^^^


----------------------------------------------------------------------
Ran 17 tests in 39.398s

If it is relevant, I am on a Windows 11 computer with Python 3.11.5.

Based on my reading of the code, it looks like the metadata's date is being read from the .UV file instead of the .MS files, but the assert statement is expecting the date to match the .MS files' format. A simple fix to get the unit test to pass would be to adjust the date format in the metadata section of the unit test's "info.json" file, but if you actively want the metadata's date to be retrieved from the .MS files and not the .UV file, it may be worth filtering by file extension when setting it here:

if 'date' not in metadata and 'date' in datafile.metadata:
metadata['date'] = datafile.metadata['date']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant