From c1a0d817d7dce8ef7b2652e32e8e591642455d6a Mon Sep 17 00:00:00 2001 From: Dustin Tran Date: Thu, 23 Mar 2017 15:21:00 -0400 Subject: [PATCH] use assert in example code snippets, and not == followed by True --- edward/util/random_variables.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/edward/util/random_variables.py b/edward/util/random_variables.py index d49defa99..52a492f51 100644 --- a/edward/util/random_variables.py +++ b/edward/util/random_variables.py @@ -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() @@ -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() @@ -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() @@ -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() @@ -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() @@ -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()