Closed audreyseo closed 3 years ago
Changing the imports on tisane/graph.py
has helped, like so:
from tisane.og_variable import (
# AbstractVariable,
Nominal,
Ordinal,
Numeric,
# Unit,
Treatment,
# Nest,
RepeatedMeasure,
# Has,
# Associate,
# Cause,
# Moderate,
GreaterThanOne,
)
from tisane.variable import (
Measure,
Unit,
AbstractVariable,
Has,
Associates,
Causes,
Moderates,
Nests
)
I'm just not sure if I'm breaking anything by doing so.
ts.og_variable
was a temporary hack I had used to test a few tests for API changes.
Since commit, this is no longer a bug. The graph has all the expected variables and edges. This means that this program:
student = ts.Unit("Student")
# Variables instantiated through Units
race = student.nominal("Race", cardinality=5)
ses = student.numeric("SES")
test_score = student.numeric("Test score")
tutoring = student.nominal("treatment", cardinality=3)
has the following nodes/passes the below tests that were failing before:
self.assertTrue(gr.has_variable(student))
self.assertTrue(gr.has_variable(race))
self.assertTrue(gr.has_variable(ses))
self.assertTrue(gr.has_variable(test_score))
self.assertFalse(gr.has_variable(tutoring))
See test_graph.py for the above test case.
For example, if we take the following code:
the
print
will print an empty list, and the assertion will fail. This seems to be becausegraph.py
requires relationships fromtisane.og_variable
instead of fromtisane.variable
, andtisane.design
callstisane.graph.Graph.add_relationship
to add edges:The types for
relationship
are imported fromtisane.og_variable
, which means that none of the relationships are added as edges.