Skip to content

Commit

Permalink
Merge pull request #44 from bmcfee/pump-fields
Browse files Browse the repository at this point in the history
added fields property to Pump
  • Loading branch information
bmcfee committed Mar 16, 2017
2 parents ea31faa + 52e53ed commit b1976b5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pumpp/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,11 @@ def sampler(self, n_samples, duration):
'''

return Sampler(n_samples, duration, *self.ops)

@property
def fields(self):
out = dict()
for op in self.ops:
out.update(**op.fields)

return out
6 changes: 6 additions & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ def test_pump(audio_f, jam, sr, hop_length):
for key in data1:
assert np.allclose(data1[key], data2[key])

fields = dict()
for op in ops:
fields.update(**op.fields)

assert pump.fields == fields


@pytest.mark.parametrize('audio_f', ['tests/data/test.ogg'])
def test_pump_empty(audio_f, jam, sr, hop_length):
Expand Down

0 comments on commit b1976b5

Please sign in to comment.