Fixed a bug in the cues to_dict method

This commit is contained in:
Jamie Hardt
2023-11-07 11:37:36 -08:00
parent c392f48819
commit d1b42bd836
2 changed files with 16 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
import unittest
import wavinfo
import glob
class TestWalk(unittest.TestCase):
def test_walk_metadata(self):
@@ -20,6 +21,17 @@ class TestWalk(unittest.TestCase):
self.assertTrue(tested_data and tested_format)
def test_walk_all(self):
for file in glob.glob('tests/test_files/**/*.wav'):
info = wavinfo.WavInfoReader(file)
try:
for _, _, _ in info.walk():
pass
except:
self.fail(f"Failed to walk metadata in file {file}")
if __name__ == '__main__':
unittest.main()

View File

@@ -247,10 +247,10 @@ class WavCuesReader:
if r.name == cue_ident), None)
def to_dict(self) -> Dict[str, Any]:
return dict(cues=[c.__dict__ for c in self.cues],
labels=[l.__dict__ for l in self.labels],
ranges=[r.__dict__ for r in self.ranges],
notes=[n.__dict__ for n in self.notes])
return dict(cues=[c._asdict() for c in self.cues],
labels=[l._asdict() for l in self.labels],
ranges=[r._asdict() for r in self.ranges],
notes=[n._asdict() for n in self.notes])