Skip to content

Commit

Permalink
use assert in example code snippets, and not == followed by True
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinvtran committed Mar 23, 2017
1 parent f1621e5 commit c1a0d81
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions edward/util/random_variables.py
Expand Up @@ -376,8 +376,7 @@ def get_ancestors(x, collection=None):
>>> b = Normal(mu=a, sigma=1.0)
>>> c = Normal(mu=0.0, sigma=1.0)
>>> d = Normal(mu=tf.mul(b, c), sigma=1.0)
>>> set(ed.get_ancestors(d)) == set([a, b, c])
True
>>> assert set(ed.get_ancestors(d)) == set([a, b, c])
"""
if collection is None:
collection = random_variables()
Expand Down Expand Up @@ -429,8 +428,7 @@ def get_children(x, collection=None):
>>> b = Normal(mu=a, sigma=1.0)
>>> c = Normal(mu=a, sigma=1.0)
>>> d = Normal(mu=c, sigma=1.0)
>>> set(ed.get_children(a)) == set([b, c])
True
>>> assert set(ed.get_children(a)) == set([b, c])
"""
if collection is None:
collection = random_variables()
Expand Down Expand Up @@ -483,8 +481,7 @@ def get_descendants(x, collection=None):
>>> b = Normal(mu=a, sigma=1.0)
>>> c = Normal(mu=a, sigma=1.0)
>>> d = Normal(mu=c, sigma=1.0)
>>> set(ed.get_descendants(a)) == set([b, c, d])
True
>>> assert set(ed.get_descendants(a)) == set([b, c, d])
"""
if collection is None:
collection = random_variables()
Expand Down Expand Up @@ -537,8 +534,7 @@ def get_parents(x, collection=None):
>>> b = Normal(mu=a, sigma=1.0)
>>> c = Normal(mu=0.0, sigma=1.0)
>>> d = Normal(mu=tf.mul(b, c), sigma=1.0)
>>> set(ed.get_parents(d)) == set([b, c])
True
>>> assert set(ed.get_parents(d)) == set([b, c])
"""
if collection is None:
collection = random_variables()
Expand Down Expand Up @@ -589,8 +585,7 @@ def get_siblings(x, collection=None):
>>> a = Normal(mu=0.0, sigma=1.0)
>>> b = Normal(mu=a, sigma=1.0)
>>> c = Normal(mu=a, sigma=1.0)
>>> ed.get_siblings(b) == [c]
True
>>> assert ed.get_siblings(b) == [c]
"""
parents = get_parents(x, collection)
siblings = set()
Expand Down Expand Up @@ -622,8 +617,7 @@ def get_variables(x, collection=None):
>>> a = tf.Variable(0.0)
>>> b = tf.Variable(0.0)
>>> c = Normal(mu=tf.mul(a, b), sigma=1.0)
>>> set(ed.get_variables(c)) == set([a, b])
True
>>> assert set(ed.get_variables(c)) == set([a, b])
"""
if collection is None:
collection = tf.global_variables()
Expand Down

0 comments on commit c1a0d81

Please sign in to comment.