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

Added 10 comments that illustrate each tests in EventAccumulator. #9592

Merged
merged 3 commits into from May 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -225,6 +225,7 @@ def testEmptyAccumulator(self):
self.assertTagsEqual(x.Tags(), {})

def testTags(self):
"""Tags should be found in EventAccumulator after adding some events."""
gen = _EventGenerator(self)
gen.AddScalar('s1')
gen.AddScalar('s2')
Expand All @@ -245,6 +246,7 @@ def testTags(self):
})

def testReload(self):
"""EventAccumulator contains suitable tags after calling Reload."""
gen = _EventGenerator(self)
acc = ea.EventAccumulator(gen)
acc.Reload()
Expand All @@ -267,6 +269,7 @@ def testReload(self):
})

def testScalars(self):
"""Tests whether EventAccumulator contains scalars after adding them."""
gen = _EventGenerator(self)
acc = ea.EventAccumulator(gen)
s1 = ea.ScalarEvent(wall_time=1, step=10, value=32)
Expand All @@ -293,6 +296,7 @@ def _compareHealthPills(self, expected_event, gotten_event):
self.assertEqual(expected_value, gotten_event.value[i])

def testHealthPills(self):
"""HealthPills should be properly inserted into EventAccumulator."""
gen = _EventGenerator(self)
acc = ea.EventAccumulator(gen)
gen.AddHealthPill(13371337, 41, 'Add', 0, range(1, 13))
Expand Down Expand Up @@ -328,6 +332,7 @@ def testGetOpsWithHealthPills(self):
self.assertItemsEqual(['Add', 'MatMul'], acc.GetOpsWithHealthPills())

def testHistograms(self):
"""Tests whether histograms are inserted into EventAccumulator."""
gen = _EventGenerator(self)
acc = ea.EventAccumulator(gen)

Expand Down Expand Up @@ -377,6 +382,7 @@ def testHistograms(self):
self.assertEqual(acc.Histograms('hst2'), [hst2])

def testCompressedHistograms(self):
"""Tests compressed histograms inserted into EventAccumulator."""
gen = _EventGenerator(self)
acc = ea.EventAccumulator(gen, compression_bps=(0, 2500, 5000, 7500, 10000))

Expand Down Expand Up @@ -428,6 +434,7 @@ def testCompressedHistograms(self):
self.assertEqual(acc.CompressedHistograms('hst2'), [expected_cmphst2])

def testCompressedHistogramsWithEmptyHistogram(self):
"""Tests that empty histograms compressed properly in EventAccumulator."""
gen = _EventGenerator(self)
acc = ea.EventAccumulator(gen, compression_bps=(0, 2500, 5000, 7500, 10000))

Expand Down Expand Up @@ -481,6 +488,7 @@ def testCompressHistogram_uglyHistogram(self):
self.assertAlmostEqual(vals[8].value, 1.0)

def testImages(self):
"""Tests 2 images inserted/accessed in EventAccumulator."""
gen = _EventGenerator(self)
acc = ea.EventAccumulator(gen)
im1 = ea.ImageEvent(
Expand Down Expand Up @@ -514,6 +522,7 @@ def testImages(self):
self.assertEqual(acc.Images('im2'), [im2])

def testAudio(self):
"""Tests 2 audio events inserted/accessed in EventAccumulator."""
gen = _EventGenerator(self)
acc = ea.EventAccumulator(gen)
snd1 = ea.AudioEvent(
Expand Down Expand Up @@ -551,6 +560,7 @@ def testAudio(self):
self.assertEqual(acc.Audio('snd2'), [snd2])

def testKeyError(self):
"""KeyError should be raised when accessing non-existing keys."""
gen = _EventGenerator(self)
acc = ea.EventAccumulator(gen)
acc.Reload()
Expand All @@ -574,7 +584,7 @@ def testKeyError(self):
acc.Audio('hst1')

def testNonValueEvents(self):
"""Tests that non-value events in the generator don't cause early exits."""
"""Non-value events in the generator don't cause early exits."""
gen = _EventGenerator(self)
acc = ea.EventAccumulator(gen)
gen.AddScalar('s1', wall_time=1, step=10, value=20)
Expand Down