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

Revert "Fix bitrate parsing for cross-platform environment" #164

Merged
merged 1 commit into from
Mar 9, 2024

Conversation

lostanlen
Copy link
Member

Reverts #140

@nullptr-0 PR #140 passed your test but broke other tests!

____________________________ TestBitrate.test_aiff _____________________________

self = <test_file_info.TestBitrate testMethod=test_aiff>

    def test_aiff(self):
        actual = file_info.bitrate(INPUT_FILE2)
        expected = 768000.0
>       self.assertEqual(expected, actual)
E       AssertionError: 768000.0 != 7000.0

tests/test_file_info.py:64: AssertionError
_____________________________ TestBitrate.test_wav _____________________________

self = <test_file_info.TestBitrate testMethod=test_wav>

    def test_wav(self):
        actual = file_info.bitrate(INPUT_FILE)
        expected = 706000.0
>       self.assertEqual(expected, actual)
E       AssertionError: 706000.0 != 7000.0

tests/test_file_info.py:54: AssertionError
_________________________ TestBitrate.test_wav_pathlib _________________________

self = <test_file_info.TestBitrate testMethod=test_wav_pathlib>

    def test_wav_pathlib(self):
        actual = file_info.bitrate(Path(INPUT_FILE))
        expected = 706000.0
>       self.assertEqual(expected, actual)
E       AssertionError: 706000.0 != 7000.0

tests/test_file_info.py:59: AssertionError
___________________________ TestInfo.test_dictionary ___________________________

self = <test_file_info.TestInfo testMethod=test_dictionary>

    def test_dictionary(self):
        for use_pathlib in [False, True]:
            with self.subTest():
                input_file = Path(INPUT_FILE) if use_pathlib else INPUT_FILE
    
                actual = file_info.info(input_file)
                expected = {
                    'channels': 1,
                    'sample_rate': 44100.0,
                    'bitdepth': 16,
                    'bitrate': 706000.0,
                    'duration': 10.0,
                    'num_samples': 441000,
                    'encoding': 'Signed Integer PCM',
                    'silent': False
                }
>               self.assertEqual(expected, actual)
E               AssertionError: {'cha[59 chars]': 706000.0, 'duration': 10.0, 'num_samples': [53 chars]alse} != {'cha[59 chars]': 7000.0, 'duration': 10.0, 'num_samples': 44[51 chars]alse}
E                 {'bitdepth': 16,
E               -  'bitrate': 706000.0,
E               ?              --
E               
E               +  'bitrate': 7000.0,
E                  'channels': 1,
E                  'duration': 10.0,
E                  'encoding': 'Signed Integer PCM',
E                  'num_samples': 441000,
E                  'sample_rate': 44100.0,
E                  'silent': False}

tests/test_file_info.py:[34](https://github.com/rabitt/pysox/actions/runs/8215704930/job/22469464052#step:6:35)6: AssertionError

reverting for now

@lostanlen lostanlen merged commit 4342907 into master Mar 9, 2024
6 of 10 checks passed
@nullptr-0
Copy link
Contributor

nullptr-0 commented Mar 9, 2024

Reverts #140

@nullptr-0 PR #140 passed your test but broke other tests!

____________________________ TestBitrate.test_aiff _____________________________

self = <test_file_info.TestBitrate testMethod=test_aiff>

    def test_aiff(self):
        actual = file_info.bitrate(INPUT_FILE2)
        expected = 768000.0
>       self.assertEqual(expected, actual)
E       AssertionError: 768000.0 != 7000.0

tests/test_file_info.py:64: AssertionError
_____________________________ TestBitrate.test_wav _____________________________

self = <test_file_info.TestBitrate testMethod=test_wav>

    def test_wav(self):
        actual = file_info.bitrate(INPUT_FILE)
        expected = 706000.0
>       self.assertEqual(expected, actual)
E       AssertionError: 706000.0 != 7000.0

tests/test_file_info.py:54: AssertionError
_________________________ TestBitrate.test_wav_pathlib _________________________

self = <test_file_info.TestBitrate testMethod=test_wav_pathlib>

    def test_wav_pathlib(self):
        actual = file_info.bitrate(Path(INPUT_FILE))
        expected = 706000.0
>       self.assertEqual(expected, actual)
E       AssertionError: 706000.0 != 7000.0

tests/test_file_info.py:59: AssertionError
___________________________ TestInfo.test_dictionary ___________________________

self = <test_file_info.TestInfo testMethod=test_dictionary>

    def test_dictionary(self):
        for use_pathlib in [False, True]:
            with self.subTest():
                input_file = Path(INPUT_FILE) if use_pathlib else INPUT_FILE
    
                actual = file_info.info(input_file)
                expected = {
                    'channels': 1,
                    'sample_rate': 44100.0,
                    'bitdepth': 16,
                    'bitrate': 706000.0,
                    'duration': 10.0,
                    'num_samples': 441000,
                    'encoding': 'Signed Integer PCM',
                    'silent': False
                }
>               self.assertEqual(expected, actual)
E               AssertionError: {'cha[59 chars]': 706000.0, 'duration': 10.0, 'num_samples': [53 chars]alse} != {'cha[59 chars]': 7000.0, 'duration': 10.0, 'num_samples': 44[51 chars]alse}
E                 {'bitdepth': 16,
E               -  'bitrate': 706000.0,
E               ?              --
E               
E               +  'bitrate': 7000.0,
E                  'channels': 1,
E                  'duration': 10.0,
E                  'encoding': 'Signed Integer PCM',
E                  'num_samples': 441000,
E                  'sample_rate': 44100.0,
E                  'silent': False}

tests/test_file_info.py:[34](https://github.com/rabitt/pysox/actions/runs/8215704930/job/22469464052#step:6:35)6: AssertionError

reverting for now

Only #163 is good and simple enough to fix the bug. As for #140, there's some problem with its far-too-complex logic and it actually doesn't work. (It CAN be fixed though, but it will become even more complex.)

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

Successfully merging this pull request may close these issues.

2 participants