public void DoesntMatchBadVariable() { var matchDict2 = "a! = { 'Alice': 7, 'Toby': 'Nuts' }"; var matches = PythonCodeCompletionProviderCommon.FindVariableStatementWithRegex(matchDict2, PythonCodeCompletionProviderCommon.dictRegex); Assert.AreEqual(0, matches.Count); }
public void CanMatchIntSingleLine() { var matchDict = "a = 2"; var matches = PythonCodeCompletionProviderCommon.FindVariableStatementWithRegex(matchDict, PythonCodeCompletionProviderCommon.intRegex); Assert.AreEqual(1, matches.Count); Assert.IsTrue(matches.ContainsKey("a")); Assert.AreEqual("2", matches["a"]); }
public void CanMatchBasicArrayVarSingleLine() { var matchArray = "a = []"; var matches = PythonCodeCompletionProviderCommon.FindVariableStatementWithRegex(matchArray, PythonCodeCompletionProviderCommon.arrayRegex); Assert.AreEqual(1, matches.Count); Assert.IsTrue(matches.ContainsKey("a")); Assert.AreEqual("[]", matches["a"]); }
public void CanMatchBasicNumVarSingleLine() { var matchNumVar = "a = 5.0"; var matches = PythonCodeCompletionProviderCommon.FindVariableStatementWithRegex(matchNumVar, PythonCodeCompletionProviderCommon.doubleRegex); Assert.AreEqual(1, matches.Count); Assert.IsTrue(matches.ContainsKey("a")); Assert.AreEqual("5.0", matches["a"]); }
public void CanMatchComplexDictVarMultiLine() { var matchDict2 = "\n\na = { 'Alice': 7, 'Toby': 'Nuts' }\nb = 5.0"; var matches = PythonCodeCompletionProviderCommon.FindVariableStatementWithRegex(matchDict2, PythonCodeCompletionProviderCommon.dictRegex); Assert.AreEqual(1, matches.Count); Assert.IsTrue(matches.ContainsKey("a")); Assert.AreEqual("{ 'Alice': 7, 'Toby': 'Nuts' }", matches["a"]); }