Differential D5928 Diff 29382 python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_graphql_context_test_suite.py
Changeset View
Changeset View
Standalone View
Standalone View
python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_graphql_context_test_suite.py
Show All 22 Lines | def _yield_all(): | ||||
attr = inspect.getattr_static(klass, attr_name) | attr = inspect.getattr_static(klass, attr_name) | ||||
if isinstance(attr, staticmethod): | if isinstance(attr, staticmethod): | ||||
# the actual function is on the __func__ property | # the actual function is on the __func__ property | ||||
yield attr.__func__ | yield attr.__func__ | ||||
return list(_yield_all()) | return list(_yield_all()) | ||||
@pytest.mark.skipif(sys.version_info < (3,), reason="This behavior isn't available on 2.7") | |||||
def test_get_all_static_members(): | def test_get_all_static_members(): | ||||
class Bar: | class Bar: | ||||
class_var = "foo" | class_var = "foo" | ||||
@staticmethod | @staticmethod | ||||
def static_one(): | def static_one(): | ||||
pass | pass | ||||
@staticmethod | @staticmethod | ||||
def static_two(): | def static_two(): | ||||
pass | pass | ||||
@classmethod | @classmethod | ||||
def classthing(cls): | def classthing(cls): | ||||
pass | pass | ||||
assert set(get_all_static_functions(Bar)) == {Bar.static_one, Bar.static_two} | assert set(get_all_static_functions(Bar)) == {Bar.static_one, Bar.static_two} | ||||
@pytest.mark.skipif(sys.version_info < (3,), reason="This behavior isn't available on 2.7") | |||||
def test_all_variants_in_variants_function(): | def test_all_variants_in_variants_function(): | ||||
""" | """ | ||||
This grabs all pre-defined variants on GraphQLContextVariant (defined as static methods that | This grabs all pre-defined variants on GraphQLContextVariant (defined as static methods that | ||||
return a single ContextVariant) and tests two things: | return a single ContextVariant) and tests two things: | ||||
1) They all contain a unique test_id | 1) They all contain a unique test_id | ||||
2) That the all_variants() static method returns *all* of them | 2) That the all_variants() static method returns *all* of them | ||||
""" | """ | ||||
Show All 35 Lines |