#!/usr/bin/env python3
"""Debug script to inspect motif creation."""

import networkx as nx
from nxcypher import NXCypher

# Create test graph with self-loop
G = nx.DiGraph()
G.add_node('n1', __labels__={'A'})
G.add_edge('n1', 'n1', __labels__={'LOOP'})

# Try with explicit same node
print("=== Pattern: MATCH (n)-->(n) ===")
result2 = NXCypher(G).run("MATCH (n)-->(n) RETURN n")
print(f"Result: {result2}")

# Try with different nodes
print("\n=== Pattern: MATCH (n)-->(m) ===")
result3 = NXCypher(G).run("MATCH (n)-->(m) RETURN n, m")
print(f"Result: {result3}")

# Now test COUNT with anonymous nodes
print("\n=== Pattern: MATCH ()-->() RETURN count(*) ===")
result4 = NXCypher(G).run("MATCH ()-->() RETURN count(*)")
print(f"Result: {result4}")
print(f"Expected: {{'count(*)': [1]}} or {{'COUNT(*)': [1]}}")

# Test COUNT with same node
print("\n=== Pattern: MATCH (n)-->(n) RETURN count(*) ===")
result5 = NXCypher(G).run("MATCH (n)-->(n) RETURN count(*)")
print(f"Result: {result5}")
